On Tue, Jan 28, 2014 at 12:32:13PM -0500, Andrew Gregory wrote:
On 01/28/14 at 05:50pm, Silvan Jegen wrote:
Signed-off-by: Silvan Jegen
--- src/pacman/pacman.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 7329f0f..1d821ef 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -262,13 +262,13 @@ static void setuseragent(void) static void cleanup(int ret) { /* free alpm library resources */
This comment applies specifically to the alpm_release call and either needs to be moved with it or deleted.
My bad.
- if(config->handle && alpm_release(config->handle) == -1) { - pm_printf(ALPM_LOG_ERROR, "error releasing alpm library\n"); - } - - /* free memory */ - FREELIST(pm_targets); if(config) { + if(config->handle && alpm_release(config->handle) == -1) { + pm_printf(ALPM_LOG_ERROR, "error releasing alpm library\n"); + } + + /* free memory */ + FREELIST(pm_targets);
pm_targets is independent of config and needs to be freed whether config is NULL or not.
Ditto.
A corrected version of the patch can be found below. Hope I got it right
this time.
-->8-- (for use with git am --scissors)
Subject: [PATCH v2] Move NULL check before dereference
Signed-off-by: Silvan Jegen