commit 625e5896fc9ecf87ccfc92ad2a65cd3be58f73c0 from: Omar Polo date: Thu Sep 01 10:18:34 2022 UTC gotwebd: free all allocated fields of repo_tag got_get_repo_tags needs some tweaking to how tag_commit is allocated too. ok stsp@ commit - 89ae185cb4dd6d82b92a79daa8ef484b7da78ec3 commit + 625e5896fc9ecf87ccfc92ad2a65cd3be58f73c0 blob - 9f6c80798c87976a9ecf28e0d6ea97f818197058 blob + ac3b54fcdf929d17f3aea822d4162937114cf8a7 --- gotwebd/got_operations.c +++ gotwebd/got_operations.c @@ -573,6 +573,7 @@ got_get_repo_tags(struct request *c, int limit) struct got_tag_object *tag = NULL; struct repo_tag *rt = NULL, *trt = NULL; char *in_repo_path = NULL, *repo_path = NULL, *id_str = NULL; + char *tag_commit = NULL, *tag_commit0 = NULL; char *commit_msg = NULL, *commit_msg0 = NULL; int chk_next = 0, chk_multi = 1, commit_found = 0, c_cnt = 0; @@ -724,23 +725,30 @@ got_get_repo_tags(struct request *c, int limit) } if (commit) { - error = got_object_commit_get_logmsg(&new_repo_tag-> - tag_commit, commit); + error = got_object_commit_get_logmsg(&tag_commit0, + commit); if (error) - goto done; + goto err; got_object_commit_close(commit); commit = NULL; } else { - new_repo_tag->tag_commit = - strdup(got_object_tag_get_message(tag)); - if (new_repo_tag->tag_commit == NULL) { + tag_commit0 = strdup(got_object_tag_get_message(tag)); + if (tag_commit0 == NULL) { error = got_error_from_errno("strdup"); - goto done; + goto err; } } - while (*new_repo_tag->tag_commit == '\n') - new_repo_tag->tag_commit++; + tag_commit = tag_commit0; + while (*tag_commit == '\n') + tag_commit++; + new_repo_tag->tag_commit = strdup(tag_commit); + if (new_repo_tag->tag_commit == NULL) { + error = got_error_from_errno("strdup"); + free(tag_commit0); + goto err; + } + free(tag_commit0); if (qs->action != SUMMARY && qs->action != TAGS) { commit_msg = commit_msg0; blob - 314619a09979ee566fcfbb5f1cc283ba1336f39c blob + 0feafb3e945e44bdf1ef9bc88c821630cfd8f703 --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -538,8 +538,10 @@ void gotweb_free_repo_tag(struct repo_tag *rt) { if (rt != NULL) { - free(rt->commit_msg); free(rt->commit_id); + free(rt->tag_name); + free(rt->tag_commit); + free(rt->commit_msg); free(rt->tagger); } free(rt);