]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-plain.c
ui-blob: Do not accept mimetype from user
[ps-cgit] / ui-plain.c
index 0dd1a8b9129b2ffcdc983d300f83e2ab066e6432..58addab946af588fcb458026f9e7f5f731e6c7f5 100644 (file)
@@ -51,6 +51,7 @@ static int print_object(const unsigned char *sha1, const char *path)
        cgit_print_http_headers();
        html_raw(buf, size);
        free(mimetype);
        cgit_print_http_headers();
        html_raw(buf, size);
        free(mimetype);
+       free(buf);
        return 1;
 }
 
        return 1;
 }
 
@@ -83,8 +84,10 @@ static void print_dir(const unsigned char *sha1, const char *base,
                slash = strrchr(fullpath, '/');
                if (slash)
                        *(slash + 1) = 0;
                slash = strrchr(fullpath, '/');
                if (slash)
                        *(slash + 1) = 0;
-               else
+               else {
+                       free(fullpath);
                        fullpath = NULL;
                        fullpath = NULL;
+               }
                html("<li>");
                cgit_plain_link("../", NULL, NULL, ctx.qry.head, ctx.qry.sha1,
                                fullpath);
                html("<li>");
                cgit_plain_link("../", NULL, NULL, ctx.qry.head, ctx.qry.sha1,
                                fullpath);
@@ -180,7 +183,7 @@ void cgit_print_plain(void)
        if (!path_items.match) {
                path_items.match = "";
                walk_tree_ctx.match_baselen = -1;
        if (!path_items.match) {
                path_items.match = "";
                walk_tree_ctx.match_baselen = -1;
-               print_dir(commit->tree->object.sha1, "", 0, "");
+               print_dir(commit->tree->object.oid.hash, "", 0, "");
                walk_tree_ctx.match = 2;
        }
        else
                walk_tree_ctx.match = 2;
        }
        else