Fix resource leak 98/223098/1
authormk5004.lee <mk5004.lee@samsung.com>
Thu, 23 Jan 2020 00:56:13 +0000 (09:56 +0900)
committermk5004.lee <mk5004.lee@samsung.com>
Thu, 23 Jan 2020 00:56:13 +0000 (09:56 +0900)
Change-Id: I8eb0f9300695224fdc111a1f54e2fcd04b7da0f3
Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
pkgmgr_shortcut/src/service_register.c

index 2d8bab3..bb9c145 100644 (file)
@@ -146,6 +146,8 @@ static void db_create_version(void)
 
        if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
                ErrPrint("Failed to execute the DDL (%s)\n", err);
+               if (err)
+                       sqlite3_free(err);
                return;
        }
 
@@ -256,6 +258,8 @@ static void db_create_table(void)
 
        if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
                ErrPrint("Failed to execute the DDL (%s)\n", err);
+               if (err)
+                       sqlite3_free(err);
                return;
        }
 
@@ -265,6 +269,8 @@ static void db_create_table(void)
        ddl = "CREATE TABLE shortcut_name (id INTEGER, pkgid TEXT, lang TEXT, name TEXT, icon TEXT)";
        if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
                ErrPrint("Failed to execute the DDL (%s)\n", err);
+               if (err)
+                       sqlite3_free(err);
                return;
        }
 
@@ -281,6 +287,8 @@ static void alter_shortcut_icon(void)
 
        if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
                ErrPrint("Failed to execute the DDL (%s)\n", err);
+               if (err)
+                       sqlite3_free(err);
                return;
        }
 
@@ -295,6 +303,8 @@ static void alter_shortcut_name(void)
 
        if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
                ErrPrint("Failed to execute the DDL (%s)\n", err);
+               if (err)
+                       sqlite3_free(err);
                return;
        }
 
@@ -309,6 +319,8 @@ static void alter_shortcut_service(void)
 
        if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
                ErrPrint("Failed to execute the DDL (%s)\n", err);
+               if (err)
+                       sqlite3_free(err);
                return;
        }