From: ilho Date: Mon, 28 Jan 2019 07:52:32 +0000 (+0900) Subject: Fix possibility of double free X-Git-Tag: accepted/tizen/5.0/unified/20190419.092316~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0fafb8fc43226c8d46d11fed13f8d36939789ddc;p=platform%2Fcore%2Fappfw%2Fslp-pkgmgr.git Fix possibility of double free Change-Id: I907211b9896d3de040c4da76778c942ff7890c75 Signed-off-by: ilho --- diff --git a/installer/pkgmgr_installer.c b/installer/pkgmgr_installer.c index a15485f..f69db39 100644 --- a/installer/pkgmgr_installer.c +++ b/installer/pkgmgr_installer.c @@ -459,10 +459,12 @@ pkgmgr_installer_receive_request(pkgmgr_installer *pi, free(pi->pkgmgr_info); pi->pkgmgr_info = strndup(optarg, MAX_STRLEN); DBG("option is [i] pkgid[%s]", pi->pkgmgr_info); - if (pi->pkgmgr_info && strlen(pi->pkgmgr_info) == 0) + if (pi->pkgmgr_info && strlen(pi->pkgmgr_info) == 0) { free(pi->pkgmgr_info); - else + pi->pkgmgr_info = NULL; + } else { mode = 'i'; + } break; case 'e': /* install */