-
Notifications
You must be signed in to change notification settings - Fork 740
Closed
Description
s2n_realloc() does b->data = realloc(b->data, size)
and if b->data is then NULL it returns an error. By then, the reference to the still allocated, still valid, original memory at the original b->data has been lost and the memory leaked. b->data is now NULL yet b->size isn't zero. (This is a very common pattern of error when using realloc(3).) The return value of realloc() needs storing in a temporary and the library needs to decide if b is still intended to be valid on realloc() failure. (I would expect so.)
Metadata
Metadata
Assignees
Labels
No labels