Skip to content

Commit

Permalink
fix(paint): fix memory leak for brush paints
Browse files Browse the repository at this point in the history
  • Loading branch information
jtheoof committed Dec 30, 2019
1 parent 02bc464 commit aed2bfe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/paint.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ void paint_free(gpointer data) {
switch (paint->type) {
case SWAPPY_PAINT_MODE_BRUSH:
g_list_free_full(paint->content.brush.points, g_free);
g_free(paint);
break;
default:
g_free(paint);
Expand Down Expand Up @@ -106,9 +107,10 @@ void paint_update_temporary(struct swappy_state *state, double x, double y) {
case SWAPPY_PAINT_MODE_RECTANGLE:
case SWAPPY_PAINT_MODE_ELLIPSE:
case SWAPPY_PAINT_MODE_ARROW:
paint->can_draw = true; // all set

paint->content.shape.to.x = x;
paint->content.shape.to.y = y;
paint->can_draw = true; // all set
break;
default:
g_info("unable to update temporary paint: %d", paint->type);
Expand Down

0 comments on commit aed2bfe

Please sign in to comment.