mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
protocomm: Fixed NULL check of allocated memory
Fixes one part of - https://github.com/espressif/esp-idf/issues/6440
This commit is contained in:
parent
b8274496f9
commit
5b215dbc9e
@ -378,7 +378,7 @@ static int protocomm_version_handler(uint32_t session_id,
|
|||||||
/* Output is a non null terminated string with length specified */
|
/* Output is a non null terminated string with length specified */
|
||||||
*outlen = strlen(pc->ver);
|
*outlen = strlen(pc->ver);
|
||||||
*outbuf = malloc(*outlen);
|
*outbuf = malloc(*outlen);
|
||||||
if (outbuf == NULL) {
|
if (*outbuf == NULL) {
|
||||||
ESP_LOGE(TAG, "Failed to allocate memory for version response");
|
ESP_LOGE(TAG, "Failed to allocate memory for version response");
|
||||||
return ESP_ERR_NO_MEM;
|
return ESP_ERR_NO_MEM;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user