write_redis: remove unused variable from wr_write()
[collectd.git] / src / collectd.c
index d259753..1ccc1c0 100644 (file)
@@ -182,8 +182,10 @@ static int change_basedir (const char *orig_dir)
        while ((dirlen > 0) && (dir[dirlen - 1] == '/'))
                dir[--dirlen] = '\0';
 
-       if (dirlen <= 0)
+       if (dirlen <= 0) {
+               free (dir);
                return (-1);
+       }
 
        status = chdir (dir);
        if (status == 0)
@@ -384,8 +386,9 @@ static int pidfile_create (void)
 static int pidfile_remove (void)
 {
        const char *file = global_option_get ("PIDFile");
+       if (file == NULL)
+               return 0;
 
-       DEBUG ("unlink (%s)", (file != NULL) ? file : "<null>");
        return (unlink (file));
 } /* static int pidfile_remove (const char *file) */
 #endif /* COLLECT_DAEMON */