Add exception handling in case of memory allocation fails 04/176504/1 accepted/tizen/unified/20180425.062240 submit/tizen/20180423.061623
authorJongmin Lee <jm105.lee@samsung.com>
Thu, 19 Apr 2018 23:31:21 +0000 (08:31 +0900)
committerJongmin Lee <jm105.lee@samsung.com>
Thu, 19 Apr 2018 23:31:21 +0000 (08:31 +0900)
Change-Id: I05bdd0d15f8c71330f79e6939e0c742f3a165d96

src/e_dispatch_key_event.c

index 953fd979b4943ca8f72cbbc0cfb08c85a6605345..ff785be0d7da087d26615db309b6cf2d9c369a8b 100644 (file)
@@ -112,6 +112,9 @@ _e_dispatch_key_event(KeyEventInfo kei, Eldbus_Connection *conn, const Eldbus_Me
       return error_msg;
 
    KeyEventData *ked = (KeyEventData *)malloc(sizeof(KeyEventData));
+   if (!ked)
+        return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.Failed", "Malloc error.");
+
    ked->info.keyname = strdup(kei.keyname);
    ked->info.multiplicity = kei.multiplicity;
    ked->info.hold_time = kei.hold_time;