diff options
author | Susnata <s.sovalin@samsung.com> | 2018-03-12 05:13:11 -0400 |
---|---|---|
committer | Susnata <s.sovalin@samsung.com> | 2018-03-12 05:33:37 -0400 |
commit | 5eac3a8c72205b0c1f9cced96559eeb3765a571c (patch) | |
tree | ebd7c76d424dc186bab6925ff18210125f4e6164 | |
parent | 80204ea329810010b54b81c66aa288897acb4f26 (diff) | |
download | geofence-server-5eac3a8c72205b0c1f9cced96559eeb3765a571c.tar.gz geofence-server-5eac3a8c72205b0c1f9cced96559eeb3765a571c.tar.bz2 geofence-server-5eac3a8c72205b0c1f9cced96559eeb3765a571c.zip |
Fixed svace issues of geofence-server dbsubmit/tizen/20180326.020945accepted/tizen/unified/20180326.075312
Change-Id: Ibbe226a6700c41d291b7e7d8195ca73c1e3e1137
Signed-off-by: Susnata <s.sovalin@samsung.com>
-rwxr-xr-x | geofence-server/src/geofence_server_db.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/geofence-server/src/geofence_server_db.c b/geofence-server/src/geofence_server_db.c index 8c85238..f4c4988 100755 --- a/geofence-server/src/geofence_server_db.c +++ b/geofence-server/src/geofence_server_db.c @@ -1147,6 +1147,7 @@ int geofence_manager_set_geocoordinate_info(int fence_id, geocoordinate_info_s * ret = snprintf(data_name_lon, MAX_DATA_NAME, "%lf", geocoordinate_info->longitude); if (ret < 0) { LOGD_GEOFENCE("ERROR: String will be truncated"); + sqlite3_finalize(state); return FENCE_ERR_STRING_TRUNCATED; } @@ -1157,6 +1158,7 @@ int geofence_manager_set_geocoordinate_info(int fence_id, geocoordinate_info_s * ret = snprintf(data_name_rad, MAX_DATA_NAME, "%lf", geocoordinate_info->radius); if (ret < 0) { LOGD_GEOFENCE("ERROR: String will be truncated"); + sqlite3_finalize(state); return FENCE_ERR_STRING_TRUNCATED; } @@ -1217,6 +1219,9 @@ int geofence_manager_get_geocoordinate_info(int fence_id, geocoordinate_info_s * } *geocoordinate_info = (geocoordinate_info_s *)g_malloc0(sizeof(geocoordinate_info_s)); + if (*geocoordinate_info == NULL) { + sqlite3_finalize(state); + } g_return_val_if_fail(*geocoordinate_info, FENCE_ERR_INVALID_PARAMETER); #ifdef SUPPORT_ENCRYPTION @@ -1314,6 +1319,9 @@ int geofence_manager_get_ap_info(const int fence_id, GList **ap_list) break; } wifi_info = g_slice_new0(wifi_info_s); + if (wifi_info == NULL) { + sqlite3_finalize(state); + } g_return_val_if_fail(wifi_info, -1); if (wifi_info) { bssid = (const char *) sqlite3_column_text(state, 1); @@ -1359,6 +1367,9 @@ int geofence_manager_get_place_info(int place_id, place_info_s **place_info) return FENCE_ERR_SQLITE_FAIL; } *place_info = (place_info_s *)g_malloc0(sizeof(place_info_s)); + if (*place_info == NULL) { + sqlite3_finalize(state); + } g_return_val_if_fail(*place_info, FENCE_ERR_INTERNAL); data_name = (char *)sqlite3_column_text(state, ++index); @@ -1471,6 +1482,9 @@ int geofence_manager_get_bssid_info(const int fence_id, bssid_info_s **bssid_inf break; } bssid_info_from_db = g_slice_new0(bssid_info_s); + if (bssid_info_from_db == NULL) { + sqlite3_finalize(state); + } g_return_val_if_fail(bssid_info_from_db, -1); if (bssid_info_from_db) { bssid = (const char *)sqlite3_column_text(state, 1); @@ -2411,6 +2425,7 @@ int geofence_manager_reset(void) return FENCE_ERR_SQLITE_FAIL; } sqlite3_reset(state); + sqlite3_finalize(state); sqlite3_free(query_two); char *query_three = sqlite3_mprintf("UPDATE sqlite_sequence SET seq = 0 where name = %Q;", menu_table[FENCE_MAIN_TABLE]); @@ -2527,6 +2542,7 @@ int geofence_manager_get_count_by_params(const char *app_id, geofence_type_e fen if (*count <= 0) { LOGI_GEOFENCE("ERROR: count = %d", *count); + sqlite3_finalize(state); return FENCE_ERR_COUNT; } else { LOGI_GEOFENCE("count[%d]", *count); @@ -2623,6 +2639,7 @@ int geofence_manager_get_count_of_fences(int *count) if (*count < 0) { LOGI_GEOFENCE("ERROR: count = %d", *count); + sqlite3_finalize(state); return FENCE_ERR_COUNT; } else { LOGI_GEOFENCE("count[%d]", *count); @@ -2661,6 +2678,7 @@ int geofence_manager_get_place_count_by_placeid(int place_id, int *count) if (*count < 0) { LOGI_GEOFENCE("ERROR: place count = %d", *count); + sqlite3_finalize(state); return FENCE_ERR_COUNT; } else { LOGI_GEOFENCE("place count[%d]", *count); |