From d1071c0f4836fdc6bd37f0dc7ad6b42aa3ff78c0 Mon Sep 17 00:00:00 2001 From: Abhimanyu Swami Date: Fri, 18 Dec 2020 15:31:29 +0530 Subject: [PATCH] SVACE issue fix Change-Id: I16d7682a0072f9a0307538042c9509bb7547cc82 Signed-off-by: Abhimanyu Swami --- server/db/ctsvc_db_query.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/db/ctsvc_db_query.c b/server/db/ctsvc_db_query.c index 37d5614..69c38a6 100644 --- a/server/db/ctsvc_db_query.c +++ b/server/db/ctsvc_db_query.c @@ -3020,6 +3020,13 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, if (r_type == CTSVC_RECORD_PERSON) { unsigned int *project = malloc(sizeof(unsigned int)*ids_count); + if (project == NULL){ + ERR("Memory Allocation Failed"); + ctsvc_stmt_finalize(stmt); + contacts_list_destroy(list, true); + return CONTACTS_ERROR_OUT_OF_MEMORY; + } + for (i = 0; i < ids_count; i++) project[i] = properties[i].property_id; @@ -4203,6 +4210,12 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que ids_count = s_query->projection_count; project = malloc(sizeof(unsigned int)*ids_count); + if (project == NULL){ + ERR("Memory Allocation failed"); + ctsvc_stmt_finalize(stmt); + contacts_list_destroy(list, true); + return CONTACTS_ERROR_OUT_OF_MEMORY; + } for (i = 0; i < ids_count; i++) { if (0 == s_query->projection_count) -- 2.7.4