]> git.ipfire.org Git - thirdparty/bind9.git/commit
Rename 'free' variable to 'nfree' to not clash with free()
authorOndřej Surý <ondrej@isc.org>
Tue, 22 Jul 2025 07:32:56 +0000 (09:32 +0200)
committerOndřej Surý <ondrej@isc.org>
Tue, 22 Jul 2025 07:32:56 +0000 (09:32 +0200)
commit855960ce461ebe88342cce3105b9bdff8347c83c
treeab5ade11de25d15c480e43fddb06c0def598a0f5
parent98148d8507e1e2c33527458c1b0067fdcc37ee09
Rename 'free' variable to 'nfree' to not clash with free()

The beauty and horrors of the C - the compiler properly detects variable
shadowing, but you can freely shadow a standard function 'free()' with
variable called 'free'.  And if you reference 'free()' just as 'free'
you get the function pointer which means you can do also pointer
arithmetics, so 'free > 0' is always valid even when you delete the
local variable.

Replace the local variables 'free' with a name that doesn't shadow the
'free()' function to prevent future hard to detect bugs.
lib/dns/qp.c
tests/libtest/qp.c