Ticket #2036 (closed defect: wontfix)

Opened 14 years ago

Last modified 12 years ago

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".


  1. 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

redundant.diff (6.8 KB) - added by pavlinux 14 years ago.
redundant checks

Change History

Changed 14 years ago by pavlinux

redundant checks

comment:1 Changed 14 years ago by andrew_b

  • Priority changed from major to trivial

comment:2 Changed 12 years ago by andrew_b

  • Status changed from new to closed
  • Resolution set to wontfix
  • Branch state set to no branch
  • Milestone 4.7 deleted
Note: See TracTickets for help on using tickets.