From: Gustavo Sverzut Barbieri Date: Sun, 4 Dec 2011 14:34:02 +0000 (-0200) Subject: module refcount should start at 1. X-Git-Tag: v1~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87ca03bd0776e863a9d51f20129151137a2c8691;p=thirdparty%2Fkmod.git module refcount should start at 1. the current way was having the referenced modules to be released given the unref comparison checking for "> 0". --- diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c index ac815b27..9c679cbb 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;