Fix prevent issue
[platform/core/connectivity/bluetooth-frwk.git] / bt-otp / bt-otpserver.c
index 80348d1..93d3c50 100644 (file)
@@ -1820,6 +1820,9 @@ int _bt_otp_read_cb(const char *obj_path, char **value, int *len, uint16_t offse
 
                *len = info->value_length - offset;
                *value = (char *)malloc(sizeof(char)*(*len));
+               if (*value == NULL)
+                       return BLUETOOTH_ATT_ERROR_INTERNAL;
+
                memcpy(*value, info->char_value, *len);
 
                return BLUETOOTH_ATT_ERROR_NONE;