commit 5a57034b6f08eec784b8fe3c0b0b734eb2d4605a from: Omar Polo date: Fri Sep 02 09:53:34 2022 UTC gotwebd: free commit_msg0 only at the end of got_get_repo_tags in case of a failure between when it's allocated and when it's released it might get leaked otherwise. ok and semplification stsp@ commit - b163541dd9b5a61e6be0e3956ab1ed2c591aace5 commit + 5a57034b6f08eec784b8fe3c0b0b734eb2d4605a blob - d8514a11ea110093a8ab4f21841ed7be3cde176e blob + 04cc799c9db1c0359740a967662340d9eb76f2cd --- gotwebd/got_operations.c +++ gotwebd/got_operations.c @@ -757,10 +757,8 @@ got_get_repo_tags(struct request *c, int limit) new_repo_tag->commit_msg = strdup(commit_msg); if (new_repo_tag->commit_msg == NULL) { error = got_error_from_errno("strdup"); - free(commit_msg0); goto err; } - free(commit_msg0); } if (limit && --limit == 0) { @@ -806,6 +804,7 @@ err: if (tag) got_object_tag_close(tag); got_ref_list_free(&refs); + free(commit_msg0); free(in_repo_path); free(repo_path); free(id);