src/utils_rrdcreate.c: Free "args".
[collectd.git] / src / utils_rrdcreate.c
index 3b8f342..5368059 100644 (file)
@@ -99,6 +99,7 @@ static void srrd_create_args_destroy (srrd_create_args_t *args)
       sfree (args->argv[i]);
     sfree (args->argv);
   }
+  sfree (args);
 } /* void srrd_create_args_destroy */
 
 static srrd_create_args_t *srrd_create_args_create (const char *filename,
@@ -463,9 +464,8 @@ static int lock_file (char const *filename) /* {{{ */
     return (EEXIST);
   }
 
-  errno = 0;
   status = stat (filename, &sb);
-  if (errno != ENOENT)
+  if ((status == 0) || (errno != ENOENT))
   {
     pthread_mutex_unlock (&async_creation_lock);
     return (EEXIST);