al45tair/netifaces

Error freeing a buffer allocated on stack

NicoPy opened this issue · 2 comments

In netifaces.c, line 2101, there is free (buffer);.
However, buffer is allocated on stack char buffer[256]; at line 2076.

Nice spot. The free(buffer) is needed, but refers to a different variable that happens to be shadowed by the stack-based one. Fortunately I think that particular bit of code is very hard to reach (add_to_family() would have to fail, which it would only do, I think, if the system was catastrophically out of memory), but still. Thanks :-)

You're welcome :-)