From: Sangyoon Jang Date: Tue, 3 Sep 2019 06:03:07 +0000 (+0900) Subject: Fix static analysis issue X-Git-Tag: accepted/tizen/5.5/unified/20191031.024043~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d1e418e2f0a302ac11903fb6f6f5e856100ac9b3;p=platform%2Fcore%2Fappfw%2Fpkgmgr-tool.git Fix static analysis issue Fix null pointer dereference. Change-Id: I4088bc6a36e6f1cd936643f00ddb623af97c55dd Signed-off-by: Sangyoon Jang --- diff --git a/src/pkg_upgrade.c b/src/pkg_upgrade.c index 1dcddcd..ff9bc05 100644 --- a/src/pkg_upgrade.c +++ b/src/pkg_upgrade.c @@ -843,7 +843,16 @@ static int __find_matched_pkgid_from_list(const char *source_file, continue; version = __getvalue(buf, TOKEN_VERSION_STR, 1); + if (version == NULL) { + free(pkgid); + continue; + } pkgtype = __getvalue(buf, TOKEN_TYPE_STR, 1); + if (pkgtype == NULL) { + free(version); + free(pkgid); + continue; + } compare_result = __compare_pkgid((char *)target_file, pkgid, version, &db_update);