From c1bc88c98ed2c1dce4de8a6ed45db212a19f79f4 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Mon, 28 Apr 2014 21:02:45 -0300 Subject: [PATCH] Free abspath if kmod_module_new_from_path() fails. --- libkmod/libkmod-module.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.7.4