Re: [PATCH v2 00/29] Memory leak fixes (pt.2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Patrick

On 11/06/2024 10:19, Patrick Steinhardt wrote:
Hi,

this is the second version of my patch series that fixes various memory
leaks in our codebase.

20:  48bcd0ac80 ! 20:  144eb23617 sequencer: fix leaking string buffer in `commit_staged_changes()`
     @@ sequencer.c: static int commit_staged_changes(struct repository *r,
       			/*
       			 * If a fixup/squash in a fixup/squash chain failed, the
      @@ sequencer.c: static int commit_staged_changes(struct repository *r,
     + 				 * We need to update the squash message to skip
     + 				 * the latest commit message.
     + 				 */
     +-				int res = 0;
     + 				struct commit *commit;
     + 				const char *msg;
       				const char *path = rebase_path_squash_msg();
       				const char *encoding = get_commit_output_encoding();
@@ sequencer.c: static int commit_staged_changes(struct repository *r, p = repo_logmsg_reencode(r, commit, NULL, encoding);
       				if (!p)  {
     -@@ sequencer.c: static int commit_staged_changes(struct repository *r,
     +-					res = error(_("could not parse commit %s"),
     ++					ret = error(_("could not parse commit %s"),
     + 						    oid_to_hex(&commit->object.oid));
     + 					goto unuse_commit_buffer;
     + 				}
     + 				find_commit_subject(p, &msg);
     + 				if (write_message(msg, strlen(msg), path, 0)) {
     +-					res = error(_("could not write file: "
     ++					ret = error(_("could not write file: "
     + 						       "'%s'"), path);
     + 					goto unuse_commit_buffer;
       				}
     ++
     ++				ret = 0;
     ++
       			unuse_commit_buffer:
       				repo_unuse_commit_buffer(r, commit, p);
      -				if (res)
      -					return res;
     -+				if (res) {
     -+					ret = res;
     ++				if (ret)
      +					goto out;
     -+				}
       			}
       		}

This looks good, thanks for tweaking it

Best Wishes

Phillip




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux