summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2015-10-09 14:55:47 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2015-10-09 15:49:39 +0200
commit7ef1a47991fee31c1eb1e1292bf715d577042f35 (patch)
tree85428d32a3d3443c2fceaf307eeae822bde5463e
parent525c815cc400bc49881144bcd7e7b717bbc1af5d (diff)
ui-repolist: fix resource leak: free before return
Coverity-id: 13931
Signed-off-by: Christian Hesse <mail@eworm.de>
-rw-r--r--ui-repolist.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ui-repolist.c b/ui-repolist.c
index ac1b3e3..4f52e0f 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -18,8 +18,10 @@ static time_t read_agefile(char *path)
 	char *buf;
 	struct strbuf date_buf = STRBUF_INIT;
 
-	if (readfile(path, &buf, &size))
+	if (readfile(path, &buf, &size)) {
+		free(buf);
 		return -1;
+	}
 
 	if (parse_date(buf, &date_buf) == 0)
 		result = strtoul(date_buf.buf, NULL, 10);