Check failed malloc

FossilOrigin-Name: a8cbc5d153043c53e759567e618c4df9052c2187cdf866cf0ef5f25eb17efeec
This commit is contained in:
7u83@mail.ru 2016-03-30 06:37:55 +00:00
parent f1807c2867
commit 84535ae02f
1 changed files with 4 additions and 0 deletions

View File

@ -97,6 +97,10 @@ static struct mbag_item * get(const uint8_t *src,int len)
return NULL;
uint8_t *data = malloc(len+1);
if (!data){
free (item);
return NULL;
}
*data=len;
memcpy(data+1,src,len);
item->data=data;