mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 05:52:36 +02:00
lbutils/file ffree_and_set_null: err if null
free can take a null, that's fine, but my pointer to the pointer being freed should not be null. that is a bug. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -578,7 +578,11 @@ try_err(int loop_err, int errval)
|
||||
void
|
||||
free_and_set_null(char **buf)
|
||||
{
|
||||
if (buf == NULL || *buf == NULL)
|
||||
if (buf == NULL)
|
||||
err_exit(EFAULT,
|
||||
"null ptr (to ptr for freeing) in free_and_set_null");
|
||||
|
||||
if (*buf == NULL)
|
||||
return;
|
||||
|
||||
free(*buf);
|
||||
|
||||
Reference in New Issue
Block a user