From 819b4cd54e3caec4d3803cc62772369031ed0847 Mon Sep 17 00:00:00 2001 From: Silvan Jegen Date: Tue, 28 Jan 2014 18:58:52 +0100 Subject: Move NULL check before dereference Signed-off-by: Silvan Jegen Signed-off-by: Allan McRae --- src/pacman/pacman.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index ef909783..9791ced6 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -261,18 +261,18 @@ static void setuseragent(void) */ static void cleanup(int ret) { - /* free alpm library resources */ - 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) { + /* free alpm library resources */ + if(config->handle && alpm_release(config->handle) == -1) { + pm_printf(ALPM_LOG_ERROR, "error releasing alpm library\n"); + } + config_free(config); config = NULL; } + /* free memory */ + FREELIST(pm_targets); exit(ret); } -- cgit v1.2.3-24-g4f1b