Check valid function pointer before calling.
authorMandeep Shetty <mandeep.shetty@intel.com>
Mon, 30 Mar 2015 22:30:42 +0000 (15:30 -0700)
committerErich Keane <erich.keane@intel.com>
Mon, 30 Mar 2015 23:26:27 +0000 (23:26 +0000)
This  fixes IOT - 431.
Check if function pointer to context deleter is valid before calling function.

Change-Id: Ie66a79b14153b3cd09b6fb478307bc5f3d17afcd
Signed-off-by: Mandeep Shetty: <mandeep.shetty@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/609
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/stack/src/occlientcb.c

index cf3f1642649e3f9f86b66cf3b8a858ac2b424e9e..9c8e1119a2b8d4d6afc42724994decf55af0e758 100644 (file)
@@ -86,7 +86,12 @@ AddClientCB (ClientCB** clientCB, OCCallbackData* cbData,
         // Ensure that the handle the SDK hands back up to the application layer for the
         // OCDoResource call matches the found ClientCB Node.
         *clientCB = cbNode;
-        cbData->cd(cbData->context);
+
+        if (cbData->cd)
+        {
+            cbData->cd(cbData->context);
+        }
+
         OCFree(*token);
         OCFree(*handle);
         OCFree(requestUri);