diff options
author | Hyunho <hhstark.kang@samsung.com> | 2021-06-09 17:32:30 +0900 |
---|---|---|
committer | Hyunho <hhstark.kang@samsung.com> | 2021-06-10 10:39:06 +0900 |
commit | df3f2606f94e5f91d24acb086c1f11f9a8f054a1 (patch) | |
tree | dc1997735216e40153c4ff2646cd0418eef0eb82 | |
parent | 5ecaee1ff6afbf1ff90301da726ed241f2779ac2 (diff) | |
download | widget-service-df3f2606f94e5f91d24acb086c1f11f9a8f054a1.tar.gz widget-service-df3f2606f94e5f91d24acb086c1f11f9a8f054a1.tar.bz2 widget-service-df3f2606f94e5f91d24acb086c1f11f9a8f054a1.zip |
Fix memory leak
Change-Id: I39d0d7207a3e576c92816f75b94327940a159b67
Signed-off-by: Hyunho <hhstark.kang@samsung.com>
-rw-r--r-- | src/widget_service.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/widget_service.c b/src/widget_service.c index 43edf75..53a11ee 100644 --- a/src/widget_service.c +++ b/src/widget_service.c @@ -2261,28 +2261,25 @@ static char *__get_widget_main_appid_from_pkgid_or_appid(const char *id) ret = pkgmgrinfo_appinfo_get_appinfo(id, &appinfo); if (ret != PMINFO_R_OK) { _E("Failed to get app/pkg info - %s", id); - return NULL; + goto end; } ret = pkgmgrinfo_appinfo_get_pkgid(appinfo, &pkgid); if (ret != PMINFO_R_OK) { _E("Failed to get pkgid - %s", id); - pkgmgrinfo_appinfo_destroy_appinfo(appinfo); - return NULL; + goto end; } ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &pkginfo); if (ret != PMINFO_R_OK) { _E("Failed to get pkginfo - %s", id); - pkgmgrinfo_appinfo_destroy_appinfo(appinfo); - return NULL; + goto end; } new_pkgid = strdup(pkgid); - pkgmgrinfo_appinfo_destroy_appinfo(appinfo); if (new_pkgid == NULL) { _E("out of memory"); /* LCOV_EXCL_LINE */ - return NULL; /* LCOV_EXCL_LINE */ + goto end; /* LCOV_EXCL_LINE */ } id = new_pkgid; } @@ -2317,7 +2314,10 @@ static char *__get_widget_main_appid_from_pkgid_or_appid(const char *id) } end: - pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo); + if (pkginfo) + pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo); + if (appinfo) + pkgmgrinfo_appinfo_destroy_appinfo(appinfo); if (new_pkgid) free(new_pkgid); |