public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug malloc/14981] New: mtrace realloc
@ 2012-12-22 15:02 joost.vandevondele at mat dot ethz.ch
2012-12-22 15:03 ` [Bug malloc/14981] " joost.vandevondele at mat dot ethz.ch
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: joost.vandevondele at mat dot ethz.ch @ 2012-12-22 15:02 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=14981
Bug #: 14981
Summary: mtrace realloc
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: malloc
AssignedTo: unassigned@sourceware.org
ReportedBy: joost.vandevondele@mat.ethz.ch
Classification: Unclassified
The following program causes mtrace.pl to report memory leaks.
> cat test.c
void main()
{
int* i;
mtrace();
i=malloc(sizeof(int));
i=realloc(i,0);
muntrace();
}
mtrace ./t.dat
Memory not freed:
-----------------
Address Size Caller
0x0000000000a96460 0x4 at 0x400678
It looks like mtrace.pl is not considering realloc(x,0) equivalent to a free.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug malloc/14981] mtrace realloc
2012-12-22 15:02 [Bug malloc/14981] New: mtrace realloc joost.vandevondele at mat dot ethz.ch
@ 2012-12-22 15:03 ` joost.vandevondele at mat dot ethz.ch
2012-12-23 2:31 ` bugdal at aerifal dot cx
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: joost.vandevondele at mat dot ethz.ch @ 2012-12-22 15:03 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=14981
Joost VandeVondele <joost.vandevondele at mat dot ethz.ch> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |joost.vandevondele at mat
| |dot ethz.ch
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug malloc/14981] mtrace realloc
2012-12-22 15:02 [Bug malloc/14981] New: mtrace realloc joost.vandevondele at mat dot ethz.ch
2012-12-22 15:03 ` [Bug malloc/14981] " joost.vandevondele at mat dot ethz.ch
@ 2012-12-23 2:31 ` bugdal at aerifal dot cx
2012-12-23 8:36 ` schwab@linux-m68k.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: bugdal at aerifal dot cx @ 2012-12-23 2:31 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=14981
Rich Felker <bugdal at aerifal dot cx> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugdal at aerifal dot cx
--- Comment #1 from Rich Felker <bugdal at aerifal dot cx> 2012-12-23 02:31:08 UTC ---
This program has a memory leak. On glibc, malloc(0) and realloc(i, 0) both
return a unique pointer that cannot be dereferenced. Failure to free this
pointer is a memory leak.
realloc(i, 0) is only equivalent to free(i) on implementations where malloc(0)
returns 0.
I suspect you're confused by the language in POSIX that says "If size is 0 and
ptr is not a null pointer, the object pointed to is freed." This does not
preclude a memory leak. Note that POSIX later says "If size is 0, either a null
pointer or a unique pointer that can be successfully passed to free() shall be
returned." The confusion stems from the fact that POSIX has misleadingly
reworded the specification of free to refer to "changing the size of an
object", a concept which ISO C intentionally avoids. In the ISO C language, a
successful realloc _always_ frees the original object, and returns a pointer to
a new object with the same contents (up to the minimum of the old and new
size).
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug malloc/14981] mtrace realloc
2012-12-22 15:02 [Bug malloc/14981] New: mtrace realloc joost.vandevondele at mat dot ethz.ch
2012-12-22 15:03 ` [Bug malloc/14981] " joost.vandevondele at mat dot ethz.ch
2012-12-23 2:31 ` bugdal at aerifal dot cx
@ 2012-12-23 8:36 ` schwab@linux-m68k.org
2012-12-23 16:31 ` joseph at codesourcery dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: schwab@linux-m68k.org @ 2012-12-23 8:36 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=14981
--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> 2012-12-23 08:36:20 UTC ---
In glibc realloc(0,s) == malloc(s), and realloc(i,0) == (free(i),0) for i != 0.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug malloc/14981] mtrace realloc
2012-12-22 15:02 [Bug malloc/14981] New: mtrace realloc joost.vandevondele at mat dot ethz.ch
` (2 preceding siblings ...)
2012-12-23 8:36 ` schwab@linux-m68k.org
@ 2012-12-23 16:31 ` joseph at codesourcery dot com
2013-01-03 10:21 ` schwab@linux-m68k.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: joseph at codesourcery dot com @ 2012-12-23 16:31 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=14981
--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2012-12-23 16:31:05 UTC ---
Regarding realloc with size 0, see also
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_400.htm>. Some of the
problems with its semantics arose out of a change in C99 to the wording
that was used in C90.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug malloc/14981] mtrace realloc
2012-12-22 15:02 [Bug malloc/14981] New: mtrace realloc joost.vandevondele at mat dot ethz.ch
` (3 preceding siblings ...)
2012-12-23 16:31 ` joseph at codesourcery dot com
@ 2013-01-03 10:21 ` schwab@linux-m68k.org
2014-02-16 17:50 ` jackie.rosen at hushmail dot com
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: schwab@linux-m68k.org @ 2013-01-03 10:21 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=14981
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> 2013-01-03 10:20:41 UTC ---
Fixed in 2.18.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug malloc/14981] mtrace realloc
2012-12-22 15:02 [Bug malloc/14981] New: mtrace realloc joost.vandevondele at mat dot ethz.ch
` (4 preceding siblings ...)
2013-01-03 10:21 ` schwab@linux-m68k.org
@ 2014-02-16 17:50 ` jackie.rosen at hushmail dot com
2014-05-28 19:41 ` schwab at sourceware dot org
2014-06-14 5:30 ` fweimer at redhat dot com
7 siblings, 0 replies; 9+ messages in thread
From: jackie.rosen at hushmail dot com @ 2014-02-16 17:50 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=14981
Jackie Rosen <jackie.rosen at hushmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jackie.rosen at hushmail dot com
--- Comment #5 from Jackie Rosen <jackie.rosen at hushmail dot com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug malloc/14981] mtrace realloc
2012-12-22 15:02 [Bug malloc/14981] New: mtrace realloc joost.vandevondele at mat dot ethz.ch
` (5 preceding siblings ...)
2014-02-16 17:50 ` jackie.rosen at hushmail dot com
@ 2014-05-28 19:41 ` schwab at sourceware dot org
2014-06-14 5:30 ` fweimer at redhat dot com
7 siblings, 0 replies; 9+ messages in thread
From: schwab at sourceware dot org @ 2014-05-28 19:41 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=14981
Andreas Schwab <schwab at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC|jackie.rosen at hushmail dot com |
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug malloc/14981] mtrace realloc
2012-12-22 15:02 [Bug malloc/14981] New: mtrace realloc joost.vandevondele at mat dot ethz.ch
` (6 preceding siblings ...)
2014-05-28 19:41 ` schwab at sourceware dot org
@ 2014-06-14 5:30 ` fweimer at redhat dot com
7 siblings, 0 replies; 9+ messages in thread
From: fweimer at redhat dot com @ 2014-06-14 5:30 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=14981
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Flags| |security-
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-06-14 5:30 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-22 15:02 [Bug malloc/14981] New: mtrace realloc joost.vandevondele at mat dot ethz.ch
2012-12-22 15:03 ` [Bug malloc/14981] " joost.vandevondele at mat dot ethz.ch
2012-12-23 2:31 ` bugdal at aerifal dot cx
2012-12-23 8:36 ` schwab@linux-m68k.org
2012-12-23 16:31 ` joseph at codesourcery dot com
2013-01-03 10:21 ` schwab@linux-m68k.org
2014-02-16 17:50 ` jackie.rosen at hushmail dot com
2014-05-28 19:41 ` schwab at sourceware dot org
2014-06-14 5:30 ` fweimer at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).