fix a small memleak in writeatom() - stagit-gopher - A git gopher frontend. (mirror)
 (HTM) git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 5ee02bf5a3fc5f4be6a933722c13bfe3527773ae
 (DIR) parent 2afab18ce4580fb3be22d6c49380444e9844a3ce
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Mon, 10 Aug 2020 16:12:03 +0200
       
       fix a small memleak in writeatom()
       
       non-tag references were not freed.
       
       Diffstat:
         M stagit-gopher.c                     |      16 ++++++----------
       
       1 file changed, 6 insertions(+), 10 deletions(-)
       ---
 (DIR) diff --git a/stagit-gopher.c b/stagit-gopher.c
       @@ -949,21 +949,17 @@ writeatom(FILE *fp, int all)
                                commitinfo_free(ci);
                        }
                        git_revwalk_free(w);
       -        } else {
       +        } else if (getrefs(&ris, &refcount) != -1) {
                        /* references: tags */
       -                if (getrefs(&ris, &refcount) != -1) {
       -                        for (i = 0; i < refcount; i++) {
       -                                if (!git_reference_is_tag(ris[i].ref))
       -                                        continue;
       -
       +                for (i = 0; i < refcount; i++) {
       +                        if (git_reference_is_tag(ris[i].ref))
                                        printcommitatom(fp, ris[i].ci,
                                                        git_reference_shorthand(ris[i].ref));
        
       -                                commitinfo_free(ris[i].ci);
       -                                git_reference_free(ris[i].ref);
       -                        }
       -                        free(ris);
       +                        commitinfo_free(ris[i].ci);
       +                        git_reference_free(ris[i].ref);
                        }
       +                free(ris);
                }
        
                fputs("</feed>\n", fp);