The following commit has been merged in the next branch: commit 3b865a92208e3e2d95444eab16391475ce023b65 Author: Jonathan Neuschäfer j.neuschaefer@gmx.net Date: Sat Jul 30 13:16:05 2011 +0200
batctl: fix a memory leak in bat_hosts_init
normalized was not being free'd when hash_new failed, now it is.
Signed-off-by: Jonathan Neuschäfer j.neuschaefer@gmx.net
diff --git a/bat-hosts.c b/bat-hosts.c index 0ea4134..179e733 100644 --- a/bat-hosts.c +++ b/bat-hosts.c @@ -179,7 +179,7 @@ void bat_hosts_init(int read_opt) if (!host_hash) { if (read_opt & USE_BAT_HOSTS) printf("Warning - could not create bat hosts hash table\n"); - return; + goto out; }
homedir = getenv("HOME"); @@ -216,6 +216,7 @@ void bat_hosts_init(int read_opt) parse_hosts_file(&host_hash, normalized + (i * PATH_MAX), read_opt); }
+out: free(normalized); }