...
In this compliant solution, a second pointer, q
, is used to indicate whether malloc()
is called; if not, q
remains set to NULL. Passing NULL to free()
is guaranteed to safely do nothing.
...
Failing to understand the short-cirtuit circuit behavior of the logical OR or AND operator may cause unintended program behavior.
...