haptic: Check malloc() failed 77/148477/1 accepted/tizen/4.0/unified/20170911.154334 submit/tizen_4.0/20170908.052732
authorpr.jung <pr.jung@samsung.com>
Fri, 8 Sep 2017 03:04:38 +0000 (12:04 +0900)
committerpr.jung <pr.jung@samsung.com>
Fri, 8 Sep 2017 03:04:38 +0000 (12:04 +0900)
Change-Id: I206f3252a969422a2da0cf683f31c45d2112cde2
Signed-off-by: pr.jung <pr.jung@samsung.com>
src/haptic.c

index 2fcf096..10704b5 100644 (file)
@@ -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);