]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-repolist.c
ui-repolist: fix resource leak: free before return
[ps-cgit] / 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);