]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: smoke test all the API
authorEmil Velikov <emil.l.velikov@gmail.com>
Fri, 6 Sep 2024 21:40:03 +0000 (22:40 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Sat, 7 Sep 2024 15:16:25 +0000 (10:16 -0500)
Aka make sure the library does not crash if we give it a NULL as input
argument.

All entry-points but kmod_config_iter_free_iter look to be safe. Update
the final instance.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/111
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-config.c

index 343183f3acbf163413e3f49f6c61aee44f13b2d4..9fda8535ab5783aa13e83fb21f1bed28e9635f67 100644 (file)
@@ -1320,6 +1320,7 @@ KMOD_EXPORT bool kmod_config_iter_next(struct kmod_config_iter *iter)
 
 KMOD_EXPORT void kmod_config_iter_free_iter(struct kmod_config_iter *iter)
 {
-       free(iter->data);
+       if (iter)
+               free(iter->data);
        free(iter);
 }