Remove redundant g_strlcpy operation in ua_device_set_mac_address()
authorNishant Chaprana <n.chaprana@samsung.com>
Mon, 7 Oct 2019 12:28:23 +0000 (17:58 +0530)
committersaerome.kim <saerome.kim@samsung.com>
Tue, 8 Oct 2019 00:55:03 +0000 (09:55 +0900)
Change-Id: I08371368c022492f9e922486efa768441a2083c4
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
src/user-awareness-device.c

index c6a97fc7bb8005eafbc17a84af428822a28664d7..7b71a130ed9e3bf9da76f8145867257347b4c802 100755 (executable)
@@ -505,12 +505,11 @@ int ua_device_set_mac_address(
 
        g_free(device->mac);
        device->mac = g_malloc0(UA_MAC_ADDRESS_STRING_LEN);
-       if (device->mac){
-               g_strlcpy(device->mac, mac_address, UA_MAC_ADDRESS_STRING_LEN);
-       } else {
+       if (device->mac == NULL) {
                UA_ERR("Failt to allocate memory");
                return UA_ERROR_OUT_OF_MEMORY;
        }
+
        g_strlcpy(device->mac, mac_address, UA_MAC_ADDRESS_STRING_LEN);
 
        FUNC_EXIT;