[PATCH] parser: plug more leaks
Jim Meyering
jim at meyering.net
Fri Oct 22 15:37:18 UTC 2010
Jeff Darcy wrote:
> On 10/22/2010 10:12 AM, Jim Meyering wrote:
>> After these, there's one more small leak, but it's only in
>> the testing harness, so not urgent at all.
>>
>>>From 39c17c133e63a5c9b339da577a09e0a77babcf9b Mon Sep 17 00:00:00 2001
>> From: Jim Meyering <meyering at redhat.com>
>> Date: Fri, 22 Oct 2010 16:11:28 +0200
>> Subject: [PATCH] parser: plug more leaks
>>
>> * qparser.y (parse): Don't leak each expression tree.
>> (free_value): Handle v == &invalid.
>> Omit debug printf -- it would cause test failure, now that
>> we're using free_value more.
>> (main) [PARSER_UNIT_TEST]: Free "expr".
>> ---
>> qparser.y | 17 +++++++++--------
>> 1 files changed, 9 insertions(+), 8 deletions(-)
>
> ACK. Just curious: how was the printf causing test failures? Because
> we're comparing the generated parse-tree output and this piece of the
> output kept changing?
Right.
t/parser-test compares ./parser stdout with expected strings.
Once yyparse started calling free_value, its printf made the
test program emit additional output, hence diffs and test failure.
An alternative would have been to emit to stderr with
a change like s/printf/DPRINTF/
More information about the iwhd-devel
mailing list