[libvirt] [PATCH] fix memory leak in daemonUnixSocketPaths

Erik Skultety eskultet at redhat.com
Tue Jun 13 13:05:01 UTC 2017

On Tue, Jun 13, 2017 at 01:55:24PM +0200, Michal Privoznik wrote:
> On 06/13/2017 11:02 AM, Erik Skultety wrote:
> > On Mon, Jun 12, 2017 at 02:02:20AM -0400, Yi Wang wrote:
> >> The @rundir is allocated in virGetUserRuntimeDirectory, may lost
> >> when virFileMakePath failed.
> >
> > ACK. I slightly reworded the commit message and pushed.
> >
> Funny, I have a similar patch on my branch:
> https://github.com/zippy2/libvirt/commit/3c00409576f7b6158935baba7ff8059f66a1dd3b
> How about instead of putting VIR_FREE() at each exit path, we have just
> one exit path (= use more gotos) and have VIR_FREE() just once.

I wanted to suggest that, but I didn't apply the "generic" rule, rather I
judged the function as an individual, it's not a monster function, the variable
is used just in the block, so I was OK with that as it was. Of course, your
approach works just as well, it's just a few more lines of code. If you feel
like doing it, I have nothing against.


> Michal

More information about the libvir-list mailing list