]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
Improve test of double references
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Thu, 15 Dec 2011 15:42:54 +0000 (13:42 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Thu, 15 Dec 2011 15:49:13 +0000 (13:49 -0200)
test/test-mod-double-ref.c

index 872fc7e78ad7676eb050cc66920366a5fe42bdc7..90332476d9d7ed1e4c4c55102c98a790c7bfcf4b 100644 (file)
@@ -45,6 +45,28 @@ int main(int argc, char *argv[])
        printf("modname='%s' obj=%p\n", modname, mod2);
 
        kmod_module_unref(mod1);
+       kmod_module_unref(mod2);
+
+       /* same thing, but now unref the first module */
+
+       err = kmod_module_new_from_name(ctx, modname, &mod1);
+       if (err < 0) {
+               fprintf(stderr, "error creating module: '%s'\n", strerror(-err));
+               goto fail;
+       }
+
+       printf("modname='%s' obj=%p\n", modname, mod1);
+
+       kmod_module_unref(mod1);
+
+       err = kmod_module_new_from_name(ctx, modname, &mod2);
+       if (err < 0) {
+               fprintf(stderr, "error creating module: '%s'\n", strerror(-err));
+               goto fail;
+       }
+
+       printf("modname='%s' obj=%p\n", modname, mod2);
+
        kmod_module_unref(mod2);
        kmod_unref(ctx);