This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.23-506-g64ba173


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  64ba17317dc9343f0958755ad04af71ec3da637b (commit)
      from  9d52cb01f253c84e177fe2db8386deaea06a2596 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=64ba17317dc9343f0958755ad04af71ec3da637b

commit 64ba17317dc9343f0958755ad04af71ec3da637b
Author: Florian Weimer <fweimer@redhat.com>
Date:   Thu Jun 23 14:17:57 2016 +0200

    test-skeleton.c (xrealloc): Support realloc-as-free
    
    If the requested size is zero, realloc returns NULL, but the
    deallocation is still successful, unless the pointer is also
    NULL, when realloc behaves as malloc (0).

diff --git a/ChangeLog b/ChangeLog
index 5f9edb4..4bfee94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2016-06-23  Florian Weimer  <fweimer@redhat.com>
 
+	* test-skeleton.c (xrealloc): Support deallocation with n == 0.
+
+2016-06-23  Florian Weimer  <fweimer@redhat.com>
+
 	* test-skeleton.c (xmalloc, xcalloc, xrealloc): Mark as
 	potentially unused.
 
diff --git a/test-skeleton.c b/test-skeleton.c
index 0be4af1..d9bf989 100644
--- a/test-skeleton.c
+++ b/test-skeleton.c
@@ -109,10 +109,10 @@ __attribute__ ((unused))
 static void *
 xrealloc (void *p, size_t n)
 {
-  p = realloc (p, n);
-  if (p == NULL)
+  void *result = realloc (p, n);
+  if (result == NULL && (n > 0 || p == NULL))
     oom_error ("realloc", n);
-  return p;
+  return result;
 }
 
 /* Write a message to standard output.  Can be used in signal

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog       |    4 ++++
 test-skeleton.c |    6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]