Ticket #2036 (closed defect: wontfix)
Redundant NULL checks before free()
Reported by: | pavlinux | Owned by: | |
---|---|---|---|
Priority: | trivial | Milestone: | |
Component: | mc-core | Version: | master |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Branch state: | no branch | Votes for changeset: |
Description
Redundant NULL checks before free()
ANSI-C Standard:
The ANSI standard ANSI X3.159-1989 "Programming Language C."
specifies that free(NULL) is a no op.
"free deallocates the space pointed to by p: it does nothing if p is NULL."
Quoted from "The C Programming Language"
second edition by Kernighan and Ritchie with the subtitle "ANSI C".
- Kernighan and D. Ritchie, "Programming Language C",
Second edition. ISBN 5-8459-0891-4
Chapter 8.7 "Example - Memory Allocator", page 197, 2 line from the bottom :)
"... if the pointer is NULL, creates releases list of free blocks.
It contains one block of size zero, and points back to itself "
Attachments
Change History
Changed 15 years ago by pavlinux
- Attachment redundant.diff added
Note: See
TracTickets for help on using
tickets.
redundant checks