X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fcollectd.c;h=88c38acea0990e1aa8684959c55ca9e8d94877e1;hb=8c864f5e634118fce2446ebbba96a1cb7ec39dda;hp=a708665dfa4df0ee451489999a6bc4f293604790;hpb=dc691c71359a11632fd0ad3882ba0cdb6d8f9cee;p=collectd.git diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index a708665d..88c38ace 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -197,8 +197,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) @@ -408,8 +410,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 : ""); return (unlink (file)); } /* static int pidfile_remove (const char *file) */ #endif /* COLLECT_DAEMON */