summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libkmod/libkmod-module.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 1d90f34..a160d5b 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -420,8 +420,10 @@ KMOD_EXPORT int kmod_module_new_from_path(struct kmod_ctx *ctx,
}
err = kmod_module_new(ctx, name, name, namelen, NULL, 0, &m);
- if (err < 0)
+ if (err < 0) {
+ free(abspath);
return err;
+ }
m->path = abspath;
*mod = m;