summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSilvan Jegen <s.jegen@gmail.com>2014-01-28 18:58:52 +0100
committerAllan McRae <allan@archlinux.org>2014-01-30 13:40:25 +1000
commit819b4cd54e3caec4d3803cc62772369031ed0847 (patch)
treeee54bccb9970cf1b25466bfb6b561fe3328a39ca /src
parent77da9dc9748b3f151f98c4c301e8da3a2551860d (diff)
downloadpacman-819b4cd54e3caec4d3803cc62772369031ed0847.tar.xz
Move NULL check before dereference
Signed-off-by: Silvan Jegen <s.jegen@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/pacman.c14
1 files changed, 7 insertions, 7 deletions
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);
}