]> granicus.if.org Git - cgit/commitdiff
ui-repolist: fix resource leak: free before return
authorChristian Hesse <mail@eworm.de>
Fri, 9 Oct 2015 12:55:47 +0000 (14:55 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 9 Oct 2015 13:49:39 +0000 (15:49 +0200)
Coverity-id: 13931
Signed-off-by: Christian Hesse <mail@eworm.de>
ui-repolist.c

index ac1b3e391356d94b1d5370fba45e0a40ce901424..4f52e0fc93b9c06be7cad245302712167da09cf0 100644 (file)
@@ -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);