ccanlint: fix segfault caused by tests not depending on the "info" test.
authorJoey Adams <joeyadams3.14159@gmail.com>
Thu, 6 Jan 2011 20:12:18 +0000 (15:12 -0500)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 7 Jan 2011 02:47:24 +0000 (13:17 +1030)
These tests:

"depends-exist"      (compulsory_tests/check_depends_exist.c)
"info-documentation" (tests/has_info_documentation.c)

used m->info_file without checking if it was NULL,
leading to a segfault when no _info file was present.

Some other tests also used m->info_file without depending on "info",
but are taken care of indirectly by this patch.

tools/ccanlint/compulsory_tests/check_depends_exist.c
tools/ccanlint/tests/has_info_documentation.c

index d1f33b6465fbf99e0e94103c1d9d7d10b603f58f..1423b40f0357b74dac9edad1c74ec59f2d494447 100644 (file)
@@ -74,4 +74,4 @@ struct ccanlint depends_exist = {
        .check = check_depends_exist,
 };
 
-REGISTER_TEST(depends_exist, NULL);
+REGISTER_TEST(depends_exist, &has_info, NULL);
index ee89df9fc12398473ae24c059fd6724d0159205f..0a1788fd7d4fa8447239c5ab095584eafaf25c63 100644 (file)
@@ -96,4 +96,4 @@ struct ccanlint has_info_documentation = {
        .check = check_has_info_documentation,
 };
 
-REGISTER_TEST(has_info_documentation, NULL);
+REGISTER_TEST(has_info_documentation, &has_info, NULL);