]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
module refcount should start at 1.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sun, 4 Dec 2011 14:34:02 +0000 (12:34 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Sun, 4 Dec 2011 19:24:08 +0000 (17:24 -0200)
the current way was having the referenced modules to be released given
the unref comparison checking for "> 0".

libkmod/libkmod-module.c

index ac815b27687eb10518dee66a85838fa892378664..9c679cbb527304d97f7ba86b515fa7b1662d136c 100644 (file)
@@ -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;