diff --git a/targets/TARGET_Realtek/TARGET_AMEBA/RTWInterface.cpp b/targets/TARGET_Realtek/TARGET_AMEBA/RTWInterface.cpp index c3bd738977..38b45a8234 100644 --- a/targets/TARGET_Realtek/TARGET_AMEBA/RTWInterface.cpp +++ b/targets/TARGET_Realtek/TARGET_AMEBA/RTWInterface.cpp @@ -73,9 +73,7 @@ static rtw_result_t scan_result_handler( rtw_scan_handler_result_t* malloced_sca } ap.rssi = record->signal_strength; ap.channel = record->channel; - WiFiAccessPoint *accesspoint = new WiFiAccessPoint(ap); - memcpy(&scan_handler->ap_details[scan_handler->ap_num], accesspoint, sizeof(WiFiAccessPoint)); - delete[] accesspoint; + new (&scan_handler->ap_details[scan_handler->ap_num]) WiFiAccessPoint(ap); } scan_handler->ap_num++; } else{