]> git.ipfire.org Git - thirdparty/coreutils.git/commit
maint: avoid a static analysis warning in csplit
authorPádraig Brady <P@draigBrady.com>
Tue, 26 Jun 2012 10:13:45 +0000 (11:13 +0100)
committerPádraig Brady <P@draigBrady.com>
Tue, 26 Jun 2012 10:27:32 +0000 (11:27 +0100)
commit5958bb44c4d7cf3b69bb62955b3ece9d0715eb60
tree17980b19ef71cace06fa0167f6d7e06b2f3eef46
parent4f2e9d503821c3eadc7344a7e85400779822bf0d
maint: avoid a static analysis warning in csplit

The Canalyze static code analyzer correctly surmised
that there is a use-after-free bug in free_buffer()
at the line "struct line *n = l->next", if that
function is called multiple times.

This is not a runtime issue since a list of lines
will not be present in the !lines_found case.

* src/csplit.c (free_buffer): Set list head to NULL so
that this function can be called multiple times.
(load_buffer): Remove a redundant call to free_buffer().

Reported-by: Xu Zhongxing
THANKS.in
src/csplit.c