Check the return value of malloc().
Reviewed by: hselasky MFC after: 3 days
This commit is contained in:
parent
0b484c698d
commit
9998d4b63f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=216431
@ -457,6 +457,11 @@ usb_parse_configuration(struct usb_config_descriptor *config,
|
||||
|
||||
/* allocate memory for our configuration */
|
||||
ptr = malloc(a + b + c + d);
|
||||
if (ptr == NULL) {
|
||||
/* free config structure */
|
||||
free(ps.a.currcfg);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* "currifcw" must be first, hence this pointer is freed */
|
||||
ps.b.currifcw = (void *)(ptr);
|
||||
|
Loading…
Reference in New Issue
Block a user