The following commit has been merged in the next branch: commit 87ec0670dd24af83191546d85cbeb835678c5b00 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); }