[WGID-258847] Add null check after malloc 49/142849/2 accepted/tizen_4.0_unified tizen_4.0 accepted/tizen/4.0/unified/20170828.224125 accepted/tizen/unified/20170811.021111 submit/tizen/20170808.043745 submit/tizen/20170809.085632 submit/tizen_4.0/20170828.100001 submit/tizen_4.0/20170828.110001 tizen_4.0.IoT.p1_release tizen_4.0.IoT.p2_release tizen_4.0.m2_release
authorchleun.moon <chleun.moon@samsung.com>
Mon, 7 Aug 2017 09:46:53 +0000 (18:46 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Tue, 8 Aug 2017 01:53:26 +0000 (10:53 +0900)
Change-Id: Icff55bff08bc48c3b4e86593eb1def358dc34fdd
Signed-off-by: cheoleun <chleun.moon@samsung.com>
packaging/ug-setting-wifidirect-efl.spec
popup-wifidirect/src/wfd-app-util.c

index 586d522..e0ca6da 100644 (file)
@@ -1,6 +1,6 @@
 Name:       ug-setting-wifidirect-efl
 Summary:    Wi-Fi Direct setting UI gadget
-Version:    1.11.85
+Version:    1.11.86
 Release:    1
 Group:      Applications/Network
 License:    Flora-1.1
index 1c40a83..c61b9e3 100644 (file)
@@ -120,6 +120,11 @@ static void _move_data_to_app_control(const char *key, const int type,
        if (type == BUNDLE_TYPE_STR) {
                bundle_keyval_get_basic_val((bundle_keyval_t *) kv, &ptr, &size);
                buff = malloc(sizeof(char) * size + 1);
+               if (buff == NULL) {
+                       WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to allocate memory");
+                       __WFD_APP_FUNC_EXIT__;
+                       return;
+               }
                snprintf(buff, size + 1, "%s", ((char*) ptr));
                WFD_APP_LOG(WFD_APP_LOG_ERROR, "Found STR -KEY: %s, VAL: %s, SIZE: %d", key, buff, size);
 
@@ -128,6 +133,11 @@ static void _move_data_to_app_control(const char *key, const int type,
        } else if (type == BUNDLE_TYPE_BYTE) {
                bundle_keyval_get_basic_val((bundle_keyval_t *) kv, &ptr, &size);
                buff = malloc(sizeof(char) * size + 1);
+               if (buff == NULL) {
+                       WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to allocate memory");
+                       __WFD_APP_FUNC_EXIT__;
+                       return;
+               }
                snprintf(buff, size + 1, "%s", ((char*) ptr));
                WFD_APP_LOG(WFD_APP_LOG_ERROR, "Found STR -KEY: %s, VAL: %s, SIZE: %d", key, buff, size);