[pacman-dev] [PATCH] Fix several memleaks, mostly related to errors handling.

Aaron Griffin aaronmgriffin at gmail.com
Mon Nov 26 16:49:14 EST 2007


On Nov 24, 2007 5:02 AM, Xavier <shiningxc at gmail.com> wrote:
> That's the first thing I thought about, but I don't know if that is possible.
> There are two lists that can only be freed after the error happens : *data
> and deps (asked could be freed before).
> Or maybe it is possible to do something like :
> MALLOC(miss, sizeof(pmdepmissing_t), FREELIST(*data);  FREELIST(deps);
>   RET_ERR(PM_ERR_MEMORY, -1));
>
> Though, there is also the "goto cleanup;" that would be skipped, and so the
> "alpm_list_free(list);", so that's yet another call to add there.
> So that would duplicate the "FREELIST(deps)'" and "alpm_list_free(list);"
> calls.

While this one has already been merged, you could still use the macro
by simply throwing something like (void)0 in the third param. Or even
pm_errno = BLAHBLAH.
This way we still get the output from the macro, even if we don't get
the real failure+return.




More information about the pacman-dev mailing list