Apply same logic as in delete_module.c, i.e. pass a reference to a
pointer instead of the pointer value, otherwise we cannot update
the linked list and added entries are lost.
Spotted with ASAN while running testsuite.
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/141
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
static bool need_init = true;
static struct kmod_ctx *ctx;
-static void parse_retcodes(struct mod *_modules, const char *s)
+static void parse_retcodes(struct mod **_modules, const char *s)
{
const char *p;
mod->name[modnamelen] = '\0';
mod->ret = ret;
mod->errcode = errcode;
- mod->next = _modules;
- _modules = mod;
+ mod->next = *_modules;
+ *_modules = mod;
}
}
ctx = kmod_new(NULL, NULL);
- parse_retcodes(modules, s);
+ parse_retcodes(&modules, s);
}
static inline bool module_is_inkernel(const char *modname)