kopia lustrzana https://github.com/espressif/esp-idf
component/bt: add protection in GKI_getbuf to protect against memory allocation failure;
rodzic
d50792dec9
commit
dae40afffb
|
@ -196,12 +196,17 @@ void GKI_init_q (BUFFER_Q *p_q)
|
|||
void *GKI_getbuf (UINT16 size)
|
||||
{
|
||||
BUFFER_HDR_T *header = osi_malloc(size + BUFFER_HDR_SIZE);
|
||||
header->status = BUF_STATUS_UNLINKED;
|
||||
header->p_next = NULL;
|
||||
header->Type = 0;
|
||||
header->size = size;
|
||||
assert(header != NULL);
|
||||
if (header != NULL) {
|
||||
header->status = BUF_STATUS_UNLINKED;
|
||||
header->p_next = NULL;
|
||||
header->Type = 0;
|
||||
header->size = size;
|
||||
|
||||
return header + 1;
|
||||
return header + 1;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue