From 87ca03bd0776e863a9d51f20129151137a2c8691 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Sun, 4 Dec 2011 12:34:02 -0200 Subject: [PATCH] module refcount should start at 1. the current way was having the referenced modules to be released given the unref comparison checking for "> 0". --- libkmod/libkmod-module.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c index ac815b2..9c679cb 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c @@ -142,6 +142,7 @@ KMOD_EXPORT int kmod_module_new_from_name(struct kmod_ctx *ctx, m->ctx = kmod_ref(ctx); m->name = strdup(name); + m->refcount = 1; *mod = m; @@ -171,6 +172,7 @@ KMOD_EXPORT int kmod_module_new_from_path(struct kmod_ctx *ctx, m->ctx = kmod_ref(ctx); m->path = strdup(path); + m->refcount = 1; *mod = m; -- 2.7.4