diff options
author | Jiyong Min <jiyong.min@samsung.com> | 2018-01-26 17:05:43 +0900 |
---|---|---|
committer | Jiyong Min <jiyong.min@samsung.com> | 2018-01-26 08:10:39 +0000 |
commit | 779750ed59e70a743351750065e9be385c965025 (patch) | |
tree | c017a54fc8fa56470a9677545dfb00c2f78873a5 | |
parent | 800932efd9cc7b9e207df3b13537ae9d868c6049 (diff) | |
download | media-controller-779750ed59e70a743351750065e9be385c965025.tar.gz media-controller-779750ed59e70a743351750065e9be385c965025.tar.bz2 media-controller-779750ed59e70a743351750065e9be385c965025.zip |
Fix HANDLE_LEAK_SQLITE_STATEMENT issuesubmit/tizen/20180130.011229accepted/tizen/unified/20180130.055216
Change-Id: I4c3a50382a3ad035b6081c5911c085fb16cadcc8
(cherry picked from commit 04196724d55566dcd069628fdf4f5f7b75a844b7)
-rwxr-xr-x | src/media_controller_db.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/media_controller_db.c b/src/media_controller_db.c index 03b6669..c366983 100755 --- a/src/media_controller_db.c +++ b/src/media_controller_db.c @@ -400,7 +400,12 @@ int mc_db_get_metadata_info(void *handle, const char *server_name, mc_metadata_h return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; } else { _metadata = (media_controller_metadata_s *)calloc(1, sizeof(media_controller_metadata_s)); - mc_retvm_if(_metadata == NULL, MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY"); + if (_metadata == NULL) { + mc_error("OUT_OF_MEMORY"); + SQLITE3_FINALIZE(stmt); + SQLITE3_SAFE_FREE(sql_str); + return MEDIA_CONTROLLER_ERROR_OUT_OF_MEMORY; + } if (MC_STRING_VALID((const char *)sqlite3_column_text(stmt, MC_SERVER_FIELD_TITLE))) _metadata->title = strdup((const char *)sqlite3_column_text(stmt, MC_SERVER_FIELD_TITLE)); |