From 8b579db1a5b3023cbff8a1672d3625d726afd1d1 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 5 Aug 2016 18:31:30 +0200 Subject: Fix memory leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/servers/coopgamma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/servers') diff --git a/src/servers/coopgamma.c b/src/servers/coopgamma.c index d3e7f34..26b000d 100644 --- a/src/servers/coopgamma.c +++ b/src/servers/coopgamma.c @@ -157,6 +157,8 @@ static ssize_t add_filter(struct output* restrict out, struct filter* restrict f { filter_destroy(out->table_filters + i); out->table_filters[i] = *filter; + filter->class = NULL; + filter->ramps = NULL; return (ssize_t)i; } @@ -202,6 +204,8 @@ static ssize_t add_filter(struct output* restrict out, struct filter* restrict f return -1; out->table_filters[i] = *filter; + filter->class = NULL; + filter->ramps = NULL; return (ssize_t)i; } @@ -455,11 +459,11 @@ int handle_set_gamma(size_t conn, const char* restrict message_id, const char* r if ((r = add_filter(output, &filter)) < 0) goto fail; - filter.class = NULL; - filter.ramps = NULL; if (flush_filters(output, (size_t)r)) goto fail; + free(filter.class); + free(filter.ramps); return send_errno(0); fail: -- cgit v1.2.3-70-g09d2