commit ddcf1d336cfcbb86f25f1d7bc1158316138b126d from: Omar Polo via: Thomas Adam date: Fri Sep 02 15:54:01 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 - 19d60ee3e107682f62ef5f79ccc2e10a28b6d533 commit + ddcf1d336cfcbb86f25f1d7bc1158316138b126d blob - 4fd7e0997a19d68b850d6815af413765d91aa206 blob + 00979097b8b3768929f4f506706fa113b708e190 --- 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);