[libvirt] [PATCH] Fix memory leak in virNetSocketNewConnectUNIX

Jiri Denemark jdenemar at redhat.com
Fri Apr 24 12:36:54 UTC 2015


On Fri, Apr 24, 2015 at 13:34:25 +0200, Michal Privoznik wrote:
> On 24.04.2015 12:03, Jiri Denemark wrote:
...
> > - error:
> > + cleanup:
> >      if (lockfd != -1) {
> >          unlink(lockpath);
> >          VIR_FORCE_CLOSE(lockfd);
> >      }
> >      VIR_FREE(lockpath);
> >      VIR_FREE(rundir);
> > -    VIR_FORCE_CLOSE(fd);
> > -    return -1;
> > +
> > +    if (ret == -1)
> 
> s/== -1/< 0/ please. It is more future proof IMO. For instance, if we
> invent new return value to describe more specifically what went wrong,
> and we still want the socket to close.

Done, will push soon. Thanks,

Jirka




More information about the libvir-list mailing list