summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiraj Kumar Goit <niraj.g@samsung.com>2016-05-30 19:21:18 +0530
committerNiraj Kumar Goit <niraj.g@samsung.com>2016-05-30 21:42:29 +0530
commit3fd4d4162e7966551a39fe5db60261f7c19a39d0 (patch)
treec6d5f554347e5ada756010f58b5ef75007cd47be
parent99d0676d2f7f0664af93ff2da4a04b24ffef9249 (diff)
downloadconnman-3fd4d4162e7966551a39fe5db60261f7c19a39d0.tar.gz
connman-3fd4d4162e7966551a39fe5db60261f7c19a39d0.tar.bz2
connman-3fd4d4162e7966551a39fe5db60261f7c19a39d0.zip
Added NULL check before derefrencing of pointer variable. Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com> Change-Id: If065f024fe62e72887591f54eaabf4ed70a8d2e2
-rwxr-xr-xclient/commands.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/client/commands.c b/client/commands.c
index 9208016b..3f7e0010 100755
--- a/client/commands.c
+++ b/client/commands.c
@@ -2189,12 +2189,30 @@ static struct _peer_service *fill_in_peer_service(unsigned char *bjr_query,
service = dbus_malloc0(sizeof(*service));
+#if defined TIZEN_EXT
+ if (!service)
+ return NULL;
+#endif
+
if (bjr_query_len && bjr_response_len) {
service->bjr_query = dbus_malloc0(bjr_query_len);
+#if defined TIZEN_EXT
+ if(!service->bjr_query) {
+ dbus_free(service);
+ return NULL;
+ }
+#endif
memcpy(service->bjr_query, bjr_query, bjr_query_len);
service->bjr_query_len = bjr_query_len;
service->bjr_response = dbus_malloc0(bjr_response_len);
+#if defined TIZEN_EXT
+ if(!service->bjr_response) {
+ dbus_free(service->bjr_query);
+ dbus_free(service);
+ return NULL;
+ }
+#endif
memcpy(service->bjr_response, bjr_response, bjr_response_len);
service->bjr_response_len = bjr_response_len;
} else if (upnp_service && version) {
@@ -2202,6 +2220,12 @@ static struct _peer_service *fill_in_peer_service(unsigned char *bjr_query,
service->version = version;
} else if (wfd_ies && wfd_ies_len) {
service->wfd_ies = dbus_malloc0(wfd_ies_len);
+#if defined TIZEN_EXT
+ if (!service->wfd_ies) {
+ dbus_free(service);
+ return NULL;
+ }
+#endif
memcpy(service->wfd_ies, wfd_ies, wfd_ies_len);
service->wfd_ies_len = wfd_ies_len;
} else {