[Date Prev][Date Next]
(ITS#8487) Properly handle realloc() failures
Full_Name: Bryon Gloden, CISSP.
Submission from: (NULL) (18.104.22.168)
Greetings. On line numbers 123 and 134 of liblmdb/midl.c
are two common realloc() mistakes. Passing one pointer into realloc() and
assigning the result directly into that same pointer variable can cause a memory
leak if the reallocation fails, because the original allocation will still
exist. The correct way to do this is to use a temporary pointer variable.
Found by https://github.com/bryongloden/cppcheck