]> git.armaanb.net Git - stagit.git/blobdiff - stagit.c
fix potential leak, found by clang-analyzer
[stagit.git] / stagit.c
index d9832945177342903d3ff2696ab6d4e86a6b03ed..06b6698d67fef3eba3252951a867e32b67fdd7b8 100644 (file)
--- a/stagit.c
+++ b/stagit.c
@@ -114,6 +114,7 @@ commitinfo_getstats(struct commitinfo *ci)
                        err(1, "calloc");
                if (git_patch_from_diff(&patch, ci->diff, i)) {
                        git_patch_free(patch);
+                       free(di);
                        goto err;
                }
                di->patch = patch;
@@ -178,6 +179,7 @@ commitinfo_free(struct commitinfo *ci)
        git_tree_free(ci->parent_tree);
        git_commit_free(ci->commit);
        git_commit_free(ci->parent);
+       free(ci);
 }
 
 struct commitinfo *
@@ -221,7 +223,6 @@ commitinfo_getbyoid(const git_oid *id)
 
 err:
        commitinfo_free(ci);
-       free(ci);
 
        return NULL;
 }
@@ -696,7 +697,7 @@ writeatom(FILE *fp)
        }
        git_revwalk_free(w);
 
-       fputs("</feed>", fp);
+       fputs("</feed>\n", fp);
 
        return 0;
 }