I was looking at a port of libusb today for android and I noticed this line of code:
struct usbi_pollfd *ipollfd = malloc(sizeof(*ipollfd));
It seems that ipollfd
is being allocated based on the size of itself which has not been completely allocated yet. My first thought would be that the behavior of this is undefined. Is that the case?