Code

Merge branch 'collectd-5.5'
[collectd.git] / src / daemon / collectd.c
index cffb9a5fbb40a3567729deb544d5777832249c34..58325b95be73973b5cd5c596466255d3a325f6a5 100644 (file)
@@ -32,7 +32,6 @@
 #include "configfile.h"
 
 #include <sys/types.h>
-#include <sys/socket.h>
 #include <sys/un.h>
 #include <netdb.h>
 
@@ -197,8 +196,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)