Skip to content

Fix a double free detected by the GCC analyzer

Carl Shapiro requested to merge cshapiro/cmucl:file-author into master

The obuffer variable contained a pointer to a block of memory freed by realloc(3) if the ERANGE case was executed more than once. Afterward, if the 0 case executed, obuffer would be passed to free(3) causing a double free.

This change sets the value of obuffer to buffer immediately after a successful call to realloc(3) ensure it is always NULL or a valid block of memory.

Resolves the issue with os-common.c noted in #306

Merge request reports