flose files & free memory when not needed
authorSami Kerola <kerolasa@iki.fi>
Sat, 19 Mar 2011 19:39:01 +0000 (20:39 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sat, 19 Mar 2011 19:39:01 +0000 (20:39 +0100)
Fixes to issues found with valgrind.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>

src/getdata.c
src/other.c

index 7fbe4d0..c25d87e 100644 (file)
@@ -163,6 +163,7 @@ int parse_leases(void)
        if (macaddr != NULL) {
                free(macstring);
        }
+       fclose(dhcpd_leases);
        return 0;
 }
 
@@ -452,5 +453,6 @@ char *parse_config(int is_include, char *config_file,
                }
        }
        free(word);
+       fclose(dhcpd_config);
        return next_free_shared_name;
 }
index 42f86ca..fe5f34c 100644 (file)
@@ -94,6 +94,8 @@ void clean_up(void)
        free(config.dhcpdlease_file);
        free(config.output_file);
        free(ranges);
+       free(leases);
+       free(touches);
        free(shared_net_names);
        free(shared_networks);
 }