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 [nmh-1_3-branch]


From: Peter Maydell
Subject: [Nmh-commits] nmh sbr/utils.c ChangeLog [nmh-1_3-branch]
Date: Wed, 21 May 2008 18:07:29 +0000

CVSROOT:        /sources/nmh
Module name:    nmh
Branch:         nmh-1_3-branch
Changes by:     Peter Maydell <pm215>   08/05/21 18:07:29

Modified files:
        sbr            : utils.c 
        .              : ChangeLog 

Log message:
        Don't assume realloc() can handle NULL pointers (backport from trunk)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/nmh/sbr/utils.c?cvsroot=nmh&only_with_tag=nmh-1_3-branch&r1=1.11&r2=1.11.2.1
http://cvs.savannah.gnu.org/viewcvs/nmh/ChangeLog?cvsroot=nmh&only_with_tag=nmh-1_3-branch&r1=1.254.2.9&r2=1.254.2.10

Patches:
Index: sbr/utils.c
===================================================================
RCS file: /sources/nmh/nmh/sbr/utils.c,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -b -r1.11 -r1.11.2.1
--- sbr/utils.c 8 Nov 2007 02:28:39 -0000       1.11
+++ sbr/utils.c 21 May 2008 18:07:29 -0000      1.11.2.1
@@ -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.11.2.1 2008/05/21 18:07:29 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: /sources/nmh/nmh/ChangeLog,v
retrieving revision 1.254.2.9
retrieving revision 1.254.2.10
diff -u -b -r1.254.2.9 -r1.254.2.10
--- ChangeLog   21 May 2008 17:18:41 -0000      1.254.2.9
+++ ChangeLog   21 May 2008 18:07:29 -0000      1.254.2.10
@@ -1,5 +1,9 @@
 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.
+       (Ported from trunk.)
+
        * sbr/dtimep.lex: add some table size declarations for the
        benefit of elderly lexes with small defaults. (Ported from
        trunk.)




reply via email to

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