[Libvir] [PATCH] Plug skipped-qemudCleanup leak.

Jim Meyering jim at meyering.net
Mon Mar 3 13:07:07 UTC 2008


Daniel Veillard <veillard at redhat.com> wrote:
> On Mon, Mar 03, 2008 at 01:34:34PM +0100, Jim Meyering wrote:
>> And another:
>>
>> 	Plug skipped-qemudCleanup leak.
>>         * qemud/qemud.c (main): Call qemudCleanup also upon failure.
>>         Otherwise, an error return would skip it and induce leaks.
>>
> [...]
>> @@ -2166,8 +2166,6 @@ int main(int argc, char **argv) {
>>
>>      qemudRunLoop(server);
>>
>> -    qemudCleanup(server);
>> -
>>      close(sigwrite);
>>
>>      if (godaemon)
>> @@ -2181,6 +2179,7 @@ int main(int argc, char **argv) {
>>          unlink (pid_file);
>>
>>   error1:
>> +    qemudCleanup(server);
>>      return ret;
>>  }
>
>   Well one could argue that since return on main() is an exit,
> which will reclaim the memory it's not really a leak :-) but it's
> cleaner that way.

Of course, but for the record, this change does fix some "real" leaks,
aka, "definitely leaked", as reported by valgrind.
Otherwise I wouldn't have bothered.

There are plenty of pseudo-leaks like what you're talking about,
but "fixing" them is often counter-productive.




More information about the libvir-list mailing list