[libvirt] PATCH: 4/25: Cleanup exit paths in remote driver

Jim Meyering jim at meyering.net
Thu Jan 15 14:41:35 UTC 2009


"Daniel P. Berrange" <berrange at redhat.com> wrote:
> On Wed, Jan 14, 2009 at 10:41:50PM +0000, Daniel P. Berrange wrote:
>> On Wed, Jan 14, 2009 at 08:39:02PM +0100, Jim Meyering wrote:
>> > "Daniel P. Berrange" <berrange at redhat.com> wrote:
>> > > This patch ensures all public API methods only have a single exit
>> > > path, to make mutex unlocking simpler.
>> > >
>> > >  remote_internal.c | 1256 +++++++++++++++++++++++++++++++++++-------------------
>> >
>> > Hi Dan,
>> >
>> > I got about halfway through it and spotted something odd:
>> >
>> > > diff --git a/src/remote_internal.c b/src/remote_internal.c
>> > ...
>> > >  static int
>> > >  remoteDomainGetSchedulerParameters (virDomainPtr domain,
>> > >                                      virSchedParameterPtr params, int *nparams)
>> > ...
>> > > +cleanup:
>> > >      xdr_free ((xdrproc_t) xdr_remote_domain_get_scheduler_parameters_ret, (char *) &ret);
>> > > -    return 0;
>> > > +    if (rv != 0) {
>> > > +        for ( ; i >= 0 ; i--)
>> > > +            VIR_FREE(params[i].field);
>> > > +    }
>> > > +
>> > > +done:
>> > > +    return rv;
>> > >  }
>> >
>> > Freeing the .field member looks bogus.
>>
>> Hmmm, not sure why I added that - I must have been thinking it was a
>> malloc'd char * at the time. Clearly bogus
>
> Updated to remove that bogus chunk.

ACK to that.
I confirmed it removes just those 6 lines and
updated the git patch to match.




More information about the libvir-list mailing list