Fix resource leak 59/45259/1
authorSangyoon Jang <s89.jang@samsung.com>
Tue, 4 Aug 2015 08:02:32 +0000 (17:02 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Tue, 4 Aug 2015 08:02:32 +0000 (17:02 +0900)
finalize sqlite3_stmt
use sqlite3_close_v2 instead of sqlite3_close

Change-Id: Ie48f7b7fbc7d239ba19c46b80cb6623c4b2a1f6d
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
src/pkgmgr-info.c

index a2b62b6..5182e87 100644 (file)
@@ -830,7 +830,7 @@ static int __close_cert_db(void)
 {
        if(cert_db.ref) {
                if(--cert_db.ref == 0)
-                       sqlite3_close(GET_DB(cert_db));
+                       sqlite3_close_v2(GET_DB(cert_db));
                        return 0;
        }
        _LOGE("Certificate DB is already closed !!\n");
@@ -1504,6 +1504,8 @@ static int _pkginfo_get_label(const char *pkgid, const char *locale,
                *label = info;
        }
 
+       sqlite3_finalize(stmt);
+
        return PMINFO_R_OK;
 }
 
@@ -1556,6 +1558,8 @@ static int _pkginfo_get_icon(const char *pkgid, const char *locale,
                *icon = info;
        }
 
+       sqlite3_finalize(stmt);
+
        return PMINFO_R_OK;
 }
 
@@ -1608,6 +1612,8 @@ static int _pkginfo_get_description(const char *pkgid, const char *locale,
                *description = info;
        }
 
+       sqlite3_finalize(stmt);
+
        return PMINFO_R_OK;
 }
 
@@ -1665,6 +1671,8 @@ static int _pkginfo_get_privilege(const char *pkgid, privileges_x **privileges)
                p->privilege = info;
        }
 
+       sqlite3_finalize(stmt);
+
        return PMINFO_R_OK;
 }
 
@@ -3595,6 +3603,8 @@ static int _appinfo_get_label(const char *appid, const char *locale,
                *label = info;
        }
 
+       sqlite3_finalize(stmt);
+
        return PMINFO_R_OK;
 }
 
@@ -3647,6 +3657,8 @@ static int _appinfo_get_icon(const char *appid, const char *locale,
                *icon = info;
        }
 
+       sqlite3_finalize(stmt);
+
        return PMINFO_R_OK;
 }
 
@@ -3693,6 +3705,8 @@ static int _appinfo_get_category(const char *appid, category_x **category)
                *category = info;
        }
 
+       sqlite3_finalize(stmt);
+
        return PMINFO_R_OK;
 }
 
@@ -3734,6 +3748,8 @@ static int _appinfo_get_app_control(const char *appid,
                *appcontrol = info;
        }
 
+       sqlite3_finalize(stmt);
+
        return PMINFO_R_OK;
 }
 
@@ -3786,6 +3802,8 @@ static int _appinfo_get_data_control(const char *appid,
                *datacontrol = info;
        }
 
+       sqlite3_finalize(stmt);
+
        return PMINFO_R_OK;
 }
 
@@ -5287,6 +5305,8 @@ static GSList *_appinfo_get_metadata_filtered_list(pkgmgrinfo_filter_x *filter)
                list = g_slist_append(list, appid);
        }
 
+       sqlite3_finalize(stmt);
+
        return list;
 }