Fix latent error for OCCreateResourceWithHost. 23/923/7
authorHyunJun Kim <hyunjun2.kim@samsung.com>
Thu, 7 May 2015 07:26:12 +0000 (16:26 +0900)
committerUze Choi <uzchoi@samsung.com>
Thu, 7 May 2015 09:17:35 +0000 (09:17 +0000)
commit82e5e13ca496b4eb37cbf3cdad273c285c33f217
tree8b8bf5732fbce56a0433b8d4beb3a17923530d6d
parente8c8872cd2b63cd04fee754fcc33ecf5519ff172
Fix latent error for OCCreateResourceWithHost.

It was crashed when OCCreateResource calls using invalid uri or
already used uri.
OCCreateResource can return OC_STACK_OK, OC_STACK_INVALID_PARAM,
OC_STACK_INVALID_URI and so on.

Currently, it checks only if the result is OC_STACK_ERROR.
But, there can be a case where the result is not OC_STACK_ERROR
but 'handle' is NULL. In this case with this conditional statement,
some exceptional errors could happen.

Therefore, it should be changed for the conditional statement to check
if the resource creation is successful as intended.

Change-Id: I9921b3bb7874b1dbf8b0fda5483471506da93882
Signed-off-by: HyunJun Kim <hyunjun2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/923
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
resource/csdk/stack/src/ocstack.c