From: Florian Forster Date: Sat, 23 Feb 2013 12:13:40 +0000 (+0100) Subject: src/utils_rrdcreate.c: Free allocated memory in all error handling cases. X-Git-Tag: collectd-5.3.0~37^2~4 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=e6fd52805a38b0a052504426156dea318c70a53e src/utils_rrdcreate.c: Free allocated memory in all error handling cases. --- diff --git a/src/utils_rrdcreate.c b/src/utils_rrdcreate.c index 2228660e..33493bfd 100644 --- a/src/utils_rrdcreate.c +++ b/src/utils_rrdcreate.c @@ -472,11 +472,18 @@ static int srrd_create_async (const char *filename, status = pthread_attr_init (&attr); if (status != 0) + { + srrd_create_args_destroy (args); return (-1); + } status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); if (status != 0) + { + pthread_attr_destroy (&attr); + srrd_create_args_destroy (args); return (-1); + } status = pthread_create (&thread, &attr, srrd_create_thread, args); if (status != 0) @@ -490,6 +497,7 @@ static int srrd_create_async (const char *filename, } pthread_attr_destroy (&attr); + /* args is freed in srrd_create_thread(). */ return (0); }