[Nut-upsdev] Re: [nut-commits] svn commit r808 - in trunk: . drivers
Arjen de Korte
nut+devel at de-korte.org
Fri Feb 16 08:38:16 CET 2007
> next_device:
> + free(curDevice->Vendor);
> + free(curDevice->Product);
> + free(curDevice->Serial);
> + free(curDevice->Bus);
> usb_close(udev);
> udev = NULL;
> }
Wouldn't it be necessary to check whether there is anything to free or
not? Vendor, Product and Serial are set conditionally.
In the lines
upsdebugx(2, "- Manufacturer: %s", curDevice->Vendor ? curDevice->Vendor
: "unknown");
upsdebugx(2, "- Product: %s", curDevice->Product ? curDevice->Product :
"unknown");
upsdebugx(2, "- Serial Number: %s", curDevice->Serial ? curDevice->Serial
: "unknown");
we apparently are not sure that Vendor, Product and Serial contain were
set too, so we might risk trying to free NULL pointers here.
Best regards, Arjen
--
Eindhoven - The Netherlands
Key fingerprint - 66 4E 03 2C 9D B5 CB 9B 7A FE 7E C1 EE 88 BC 57
More information about the Nut-upsdev
mailing list