From: Lucas De Marchi Date: Thu, 15 Dec 2011 15:42:54 +0000 (-0200) Subject: Improve test of double references X-Git-Tag: v1~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=22907a188c76d646187759f665dd013e4d15641d;p=thirdparty%2Fkmod.git Improve test of double references --- diff --git a/test/test-mod-double-ref.c b/test/test-mod-double-ref.c index 872fc7e7..90332476 100644 --- a/test/test-mod-double-ref.c +++ b/test/test-mod-double-ref.c @@ -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);