]> code.delx.au - gnu-emacs/blobdiff - src/doprnt.c
Merge from emacs-24; up to 2012-12-17T11:17:34Z!rgm@gnu.org
[gnu-emacs] / src / doprnt.c
index 6c43d000522477bff0836205555d44c8de54678d..471e35c7b43c7c69ff75ffa3008f4a7d95a02125 100644 (file)
@@ -38,7 +38,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
      could include embedded null characters.
 
    . It signals an error if the length of the formatted string is about to
-     overflow MOST_POSITIVE_FIXNUM, to avoid producing strings longer than what
+     overflow ptrdiff_t or size_t, to avoid producing strings longer than what
      Emacs can handle.
 
    OTOH, this function supports only a small subset of the standard C formatted
@@ -521,7 +521,10 @@ evxprintf (char **buf, ptrdiff_t *bufsize,
       if (nbytes < *bufsize - 1)
        return nbytes;
       if (*buf != nonheapbuf)
-       xfree (*buf);
+       {
+         xfree (*buf);
+         *buf = NULL;
+       }
       *buf = xpalloc (NULL, bufsize, 1, bufsize_max, 1);
     }
 }