struct kmod_module *mod = NULL, *mod_o = NULL;
- const char *modname = NULL;
const char *abskpath = NULL;
char *p;
int i;
if (argv[i][0] == '/') {
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
+ _cleanup_free_ const char *modname = NULL;
r = kmod_module_new_from_path(ctx, argv[i], &mod_o);
if (r < 0) {
continue;
}
/* Check, if we have to load another module with that name instead */
- modname = kmod_module_get_name(mod_o);
+ modname = strdup(kmod_module_get_name(mod_o));
if (!modname) {
if (!arg_optional) {
for (FTSENT *ftsent = fts_read(fts); ftsent != NULL; ftsent = fts_read(fts)) {
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
+ _cleanup_free_ const char *modname = NULL;
if((ftsent->fts_info == FTS_D) && !check_module_path(ftsent->fts_accpath)) {
fts_set(fts, ftsent, FTS_SKIP);
}
/* Check, if we have to load another module with that name instead */
- modname = kmod_module_get_name(mod_o);
+ modname = strdup(kmod_module_get_name(mod_o));
if (!modname) {
log_error("Failed to get name for module '%s'", ftsent->fts_accpath);
}
} else {
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
- char *modname = argv[i];
+ char *modname = argv[i];
if (endswith(modname, ".ko")) {
int len = strlen(modname);