Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000688 [1003.1(2013)/Issue7+TC1] System Interfaces Objection Error 2013-05-03 16:08 2019-06-10 08:55
Reporter geoffclare View Status public  
Assigned To
Priority normal Resolution Accepted  
Status Closed  
Name Geoff Clare
Organization The Open Group
User Reference
Section realloc
Page Number 1769
Line Number 56971
Interp Status ---
Final Accepted Text
Summary 0000688: realloc(NULL, 0) vs. malloc(0)
Description The changes to the realloc() page in TC1 have introduced a conflict
between the requirements for realloc(NULL, 0) and malloc(0).

The realloc() page says:

    If ptr is a null pointer, realloc() shall be equivalent to
    malloc() for the specified size.

However, when size is 0 all that is required of malloc() is "either a
null pointer or a unique pointer that can be successfully passed to
free() shall be returned". This does not match the new requirements
for realloc(NULL, 0), where if it returns a null pointer, it must set
errno.

The intention of the realloc() changes was to allow applications to
be able to determine whether the old pointer was freed. Since this
doesn't apply when realloc() is passed a null pointer, I assume
the new requirements should only apply to the non-null case. An
alternative solution would be to change the equivalence statement
to "If ptr is a null pointer [CX]and size is non-zero[/CX], realloc()
shall be equivalent to malloc() for the specified size."
Desired Action Change:

    A null pointer shall be returned [CX]and errno set to an
    implementation-defined value[/CX].

to:

    A null pointer shall be returned [CX]and, if ptr is not a null
    pointer, errno shall set to an implementation-defined value[/CX].
Tags tc2-2008
Attached Files

- Relationships
related to 0000400Closedajosey 1003.1(2008)/Issue 7 realloc wording conflicts with C99 
related to 0000526Closedajosey 1003.1(2008)/Issue 7 Adopt C99 wording for zero size calloc(), malloc() et al. 
related to 0000374Appliedajosey 1003.1(2008)/Issue 7 malloc(0) and realloc(p,0) must not change errno on success 

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2013-05-03 16:08 geoffclare New Issue
2013-05-03 16:08 geoffclare Name => Geoff Clare
2013-05-03 16:08 geoffclare Organization => The Open Group
2013-05-03 16:08 geoffclare Section => realloc
2013-05-03 16:08 geoffclare Page Number => 1769
2013-05-03 16:08 geoffclare Line Number => 56971
2013-05-03 16:08 geoffclare Interp Status => ---
2013-05-03 23:35 nico Issue Monitored: nico
2013-05-09 15:56 eblake Relationship added related to 0000400
2013-05-09 15:57 eblake Relationship added parent of 0000526
2013-05-09 15:57 eblake Relationship added parent of 0000374
2013-05-09 15:58 Don Cragun Status New => Resolved
2013-05-09 15:58 Don Cragun Resolution Open => Accepted
2013-05-09 15:58 Don Cragun Tag Attached: tc2-2008
2013-05-09 16:23 eblake Relationship deleted parent of 0000526
2013-05-09 16:23 eblake Relationship added related to 0000526
2013-05-09 16:23 eblake Relationship deleted parent of 0000374
2013-05-09 16:23 eblake Relationship added related to 0000374
2019-06-10 08:55 agadmin Status Resolved => Closed


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker