diff --git a/kernel/module.c b/kernel/module.c index d3aaec62c1423..70a75a7216abb 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1729,6 +1729,8 @@ static int module_add_modinfo_attrs(struct module *mod) error_out: if (i > 0) module_remove_modinfo_attrs(mod, --i); + else + kfree(mod->modinfo_attrs); return error; }