Fix svace defects 40/258140/1
authorYoungjae Cho <y0.cho@samsung.com>
Tue, 11 May 2021 06:52:11 +0000 (15:52 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Tue, 11 May 2021 06:52:11 +0000 (15:52 +0900)
Change-Id: I6bb82e9293308da17217a67c98c49d8682ba9658
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/heart/heart-memory.c

index a782f33..3aca2c1 100644 (file)
@@ -448,18 +448,21 @@ int heart_memory_get_query(GArray *arrays, enum heart_data_period period)
 
                if (!md) {
                        _E("malloc failed");
+                       sqlite3_finalize(stmt);
                        return RESOURCED_ERROR_OUT_OF_MEMORY;
                }
 
                if (snprintf(md->appid, MAX_APPID_LENGTH, "%s", table->appid) < 0) {
                        _E("snprintf failed");
                        free(md);
+                       sqlite3_finalize(stmt);
                        return RESOURCED_ERROR_OUT_OF_MEMORY;
                }
 
                if (snprintf(md->pkgid, MAX_PKGNAME_LENGTH,  "%s", table->pkgid) < 0) {
                        _E("asprintf failed");
                        free(md);
+                       sqlite3_finalize(stmt);
                        return RESOURCED_ERROR_OUT_OF_MEMORY;
                }