]> git.ozlabs.org Git - ccan/commit
ccanlint: avoid segfault when module_builds' linking fails
authorPeter Barker <pb-ccan@barker.dropbear.id.au>
Fri, 10 Apr 2015 01:26:23 +0000 (11:26 +1000)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 10 Apr 2015 03:03:46 +0000 (12:33 +0930)
commitbdb8d75154d7aefe01788e5dd5adb11e3c943c11
tree4a38f033b3af14011ea10e9688b51cd3f8e5b32b
parent78158c87e37ce3b41cd5145e29baea38fd002374
ccanlint: avoid segfault when module_builds' linking fails

In the case that the objects built but linking failed, module_builds.c
called score_file_error with a NULL ccan_file object and 0 for line
number.

score_file_error assumed that the ccan_file object it is passed was
not-NULL when appending file errors to the score's aggregate error
string.  It attempted to dereference it to get "fullname".

score_error was factored out from score_file_error.  It takes a
"source" parameter, which is the file's full name (and possibly line
number) in the score_file_error case, and the ccan module name in the
case of link failure.
tools/ccanlint/ccanlint.h
tools/ccanlint/file_analysis.c
tools/ccanlint/tests/module_builds.c