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

Re: [libvirt] [PATCH] virsh.c: avoid leak on OOM error path



> >> diff --git a/tools/virsh.c b/tools/virsh.c
> >> index dd916f3..c8ae9f2 100644
> >> --- a/tools/virsh.c
> >> +++ b/tools/virsh.c
> >> @@ -7139,6 +7139,8 @@ cleanup:
> >>      return ret;
> >>
> >>  no_memory:
> >> +    VIR_FREE(list);
> >> +    VIR_FREE(buffer);
> >>      vshError(ctl, "%s", _("Out of memory"));
> >>      ret = FALSE;
> >>      return ret;
> >
> > Actually that's not enough and it also duplicates code as all the cleanup code
> > is already there:
> 
> Indeed.
> The only piece of cleanup: code that is not needed
> on the current no_memory path is the freeing of "result".
> Plugging more leaks and avoiding duplication.
> Definite improvement.  ACK.

Thanks, pushed.


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