Don't free memory that has been freed already.

Null the pointer after freeing the memory.

PR:		27370
Submitted by:	Alec Barea <alec@barea.org>
MFC after:	5 days
This commit is contained in:
n_hibma 2001-06-30 10:57:37 +00:00
parent e8eb8a31d4
commit d5adc4c167
2 changed files with 1 additions and 2 deletions

View File

@ -230,8 +230,6 @@ USB_ATTACH(uhid)
if (err) {
printf("%s: no report descriptor\n", USBDEVNAME(sc->sc_dev));
sc->sc_dying = 1;
if (desc != NULL)
free(desc, M_USBDEV);
USB_ATTACH_ERROR_RETURN;
}

View File

@ -460,6 +460,7 @@ usbd_alloc_report_desc(ifc, descp, sizep, mem)
*sizep, *descp);
if (err) {
free(*descp, mem);
*descp = NULL;
return (err);
}
return (USBD_NORMAL_COMPLETION);