From: pr.jung Date: Fri, 8 Sep 2017 03:04:38 +0000 (+0900) Subject: haptic: Check malloc() failed X-Git-Tag: submit/tizen/20170908.052749^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=23201165185bb605301b85cf935d15cc2f9a8f05;p=platform%2Fcore%2Fapi%2Fdevice.git haptic: Check malloc() failed Change-Id: I206f3252a969422a2da0cf683f31c45d2112cde2 Signed-off-by: pr.jung --- diff --git a/src/haptic.c b/src/haptic.c index 2fcf096..10704b5 100644 --- a/src/haptic.c +++ b/src/haptic.c @@ -137,6 +137,11 @@ int device_haptic_open(int device_index, haptic_device_h *device_handle) if (!found) { handle = (struct haptic_handle *)malloc(sizeof(struct haptic_handle)); + if (!handle) { + _E("Failed to malloc"); + return DEVICE_ERROR_OPERATION_FAILED; + } + handle->handle = ret; handle->index = device_index; DD_LIST_APPEND(handle_list, handle);