]> git.ipfire.org Git - thirdparty/kmod.git/commit
libkmod: Fix memory leak on error path
authorTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 21 Aug 2024 20:06:58 +0000 (22:06 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 22 Aug 2024 21:48:33 +0000 (16:48 -0500)
commitfbe86ce8a65007ecdcb76e7f47dc6585f35f788b
tree478363a673cdf0eb2b8cf0931a06d829a32d8d9e
parent84eff55d4d68b3705a86ff184aab558dfd3ce804
libkmod: Fix memory leak on error path

If realloc fails, do not override the still valid pointer with NULL.
Otherwise freeing the iterator won't free the previously allocated
buffer.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/82
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-builtin.c