Re: [PATCH] object-file: fix leak on conversion failure

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

 



On 6/22/24 12:36 AM, Eric Wong wrote:
I'm not sure exactly how to trigger the leak, but it seems fairly
obvious that the `content' buffer should be freed even if
convert_object_file() fails.  Noticed while working in this area
on unrelated things.

Definitely a good thing to include, even if it is unlikely to
be hit frequently in common scenarios.

  			ret = convert_object_file(&outbuf,
  						  the_hash_algo, input_algo,
  						  content, size, type, !do_die);
+			free(content);
  			if (ret == -1)
  				return -1;
-			free(content);

I looked at the context of this function to see that 'content'
was local to the method, so was not "owned" by something outside
of the method that might expect to reuse the buffer on failure.

Thanks,
-Stolee




[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