proc: don't increase reference count of app-info 83/130283/2
authorByungSoo Kim <bs1770.kim@samsung.com>
Wed, 5 Apr 2017 12:57:05 +0000 (21:57 +0900)
committerKwon <k_c.kwon@samsung.com>
Mon, 22 May 2017 02:14:59 +0000 (02:14 +0000)
The function proc_create_app_info can be called multiple times.
If it increases reference count of app-info continuously,
app-info is never released after application has been already terminated.

Change-Id: I614c7526e228ceb260d7f0b7c95888288b237ecb

src/proc-stat/proc-main.c

index dcbe2e2..ec68d34 100644 (file)
@@ -776,12 +776,13 @@ static struct proc_app_info *proc_create_app_info(const char *appid,
                prelaunch = pai;
        }
 
-       pai->ai = resourced_appinfo_get(pai->ai, appid, pkgid);
        if (!pai->ai) {
-               _E("Failed to get resourced_appinfo, appid(%s), pkgid(%s)", appid, pkgid);
-               free(pai);
-               prelaunch = NULL;
-               return NULL;
+               pai->ai = resourced_appinfo_get(pai->ai, appid, pkgid);
+               if (!pai->ai) {
+                       _E("Failed to get resourced_appinfo, appid(%s), pkgid(%s)", appid, pkgid);
+                       free(pai);
+                       return NULL;
+               }
        }
 
        pai->appid = pai->ai->appid;