fixed memory release bugs
authorJean-Philippe Orsini <jeanfi@gmail.com>
Mon, 5 Dec 2011 10:27:24 +0000 (10:27 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Mon, 5 Dec 2011 10:27:24 +0000 (10:27 +0000)
src/server/server.c
src/server/sysinfo.c

index ccb4d67..eec698b 100644 (file)
@@ -319,7 +319,7 @@ int main(int argc, char *argv[])
        textdomain(PACKAGE);
 #endif
 
-       server_data.www_dir = DEFAULT_WWW_DIR;
+       server_data.www_dir = NULL;
        server_data.psysinfo.interfaces = NULL;
 
        while ((optc = getopt_long(argc, argv,
@@ -348,6 +348,8 @@ int main(int argc, char *argv[])
                }
        }
 
+       server_data.www_dir = strdup(DEFAULT_WWW_DIR);
+
        if (!cmdok || optind != argc) {
                fprintf(stderr, _("Try `%s --help' for more information.\n"),
                        program_name);
index b58a607..09929da 100644 (file)
@@ -64,7 +64,7 @@ void sysinfo_update(struct psysinfo *info)
 void sysinfo_cleanup()
 {
        if (cpu)
-               free(cpu);
+               g_free(cpu);
 }
 
 static json_object *ram_to_json_object(const struct psysinfo *s)