From f2203cfa00c41b9913f43f8aaf0bd25657d4d6b9 Mon Sep 17 00:00:00 2001 From: Antonio Carzaniga Date: Sun, 12 Dec 2021 11:54:43 +0100 Subject: [PATCH] (new_ball_face) fixed memory leak for cairo patterns. --- balls.c | 1 + gravity.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/balls.c b/balls.c index 5c908b7..4d75d45 100644 --- a/balls.c +++ b/balls.c @@ -183,6 +183,7 @@ static struct ball_face * new_ball_face(unsigned int radius, cairo_surface_t * f cairo_set_source (ball_cr, pat); cairo_arc (ball_cr, 0.0, 0.0, radius, 0, 2 * M_PI); cairo_fill (ball_cr); + cairo_pattern_destroy (pat); } cairo_surface_flush(f->c_faces[i]); cairo_destroy(ball_cr); diff --git a/gravity.c b/gravity.c index 1590cdf..9658c97 100644 --- a/gravity.c +++ b/gravity.c @@ -20,7 +20,7 @@ void gravity_constant_field (double x, double y) { g_x = x; g_y = y; } - + void gravity_newton_field (double r, double g) { constant_field = 0; g_r = r;