From e6fd52805a38b0a052504426156dea318c70a53e Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 23 Feb 2013 13:13:40 +0100 Subject: [PATCH] src/utils_rrdcreate.c: Free allocated memory in all error handling cases. --- src/utils_rrdcreate.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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); } -- 2.30.2