nmh-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-commits] nmh sbr/utils.c ChangeLog


From: Peter Maydell
Subject: [Nmh-commits] nmh sbr/utils.c ChangeLog
Date: Wed, 21 May 2008 18:05:49 +0000

CVSROOT:        /cvsroot/nmh
Module name:    nmh
Changes by:     Peter Maydell <pm215>   08/05/21 18:05:49

Modified files:
        sbr            : utils.c 
        .              : ChangeLog 

Log message:
        Don't rely on realloc() to follow POSIX in handling a NULL pointer

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/nmh/sbr/utils.c?cvsroot=nmh&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/nmh/ChangeLog?cvsroot=nmh&r1=1.268&r2=1.269

Patches:
Index: sbr/utils.c
===================================================================
RCS file: /cvsroot/nmh/nmh/sbr/utils.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- sbr/utils.c 8 Nov 2007 02:28:39 -0000       1.11
+++ sbr/utils.c 21 May 2008 18:05:49 -0000      1.12
@@ -2,7 +2,7 @@
 /*
  * utils.c -- various utility routines
  *
- * $Id: utils.c,v 1.11 2007/11/08 02:28:39 jjr Exp $
+ * $Id: utils.c,v 1.12 2008/05/21 18:05:49 pm215 Exp $
  *
  * This code is Copyright (c) 2006, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -47,6 +47,10 @@
 {
     void *memory;
 
+    /* Some non-POSIX realloc()s don't cope with realloc(NULL,sz) */
+    if (!ptr)
+        return mh_xmalloc(size);
+
     if (size == 0)
         adios(NULL, "Tried to realloc 0bytes");
 

Index: ChangeLog
===================================================================
RCS file: /cvsroot/nmh/nmh/ChangeLog,v
retrieving revision 1.268
retrieving revision 1.269
diff -u -b -r1.268 -r1.269
--- ChangeLog   21 May 2008 17:16:45 -0000      1.268
+++ ChangeLog   21 May 2008 18:05:49 -0000      1.269
@@ -1,5 +1,8 @@
 2008-05-21  Peter Maydell  <address@hidden>
 
+       * sbr/utils.c (mh_xrealloc): don't assume realloc() can
+       handle NULL pointers; some non-POSIX realloc()s can't.
+
        * sbr/dtimep.lex: add some table size declarations for the
        benefit of elderly lexes with small defaults.
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]