Fix svace issues 01/223601/1
authorsooyeon.kim <sooyeon.kim@samsung.com>
Fri, 31 Jan 2020 06:04:16 +0000 (15:04 +0900)
committersooyeon.kim <sooyeon.kim@samsung.com>
Fri, 31 Jan 2020 06:04:16 +0000 (15:04 +0900)
Change-Id: Id253e0b2ce5892ef268c4f7465e3f60a06131d66
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
common/vc_cmd_db.c

index 62edb6c..310c57e 100644 (file)
@@ -2236,6 +2236,11 @@ static int __vc_db_insert_command(sqlite3* db_handle, int pid, vc_cmd_type_e typ
                        g_slist_free(cmd_list);
                        SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to insert command, %d", ret);
 
+                       if (NULL != fixed_cmd) {
+                               free(fixed_cmd);
+                               fixed_cmd = NULL;
+                       }
+
                        return ret;
                }
                cmd_list = NULL;
@@ -2245,7 +2250,11 @@ static int __vc_db_insert_command(sqlite3* db_handle, int pid, vc_cmd_type_e typ
                free(fixed_cmd);
                fixed_cmd = NULL;
        }
-       __vc_db_command_destroy((vc_cmd_h)tmp_cmd);
+
+       if (NULL != tmp_cmd) {
+               SLOG(LOG_DEBUG, vc_db_tag(), "[DEBUG] command destroy");
+               __vc_db_command_destroy((vc_cmd_h)tmp_cmd);
+       }
        return VC_DB_ERROR_NONE;
 }