emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master a314016: * src/editfns.c (Fformat): Fix use-after-f


From: Paul Eggert
Subject: [Emacs-diffs] master a314016: * src/editfns.c (Fformat): Fix use-after-free bug (Bug#20548).
Date: Wed, 13 May 2015 06:45:10 +0000

branch: master
commit a314016775858612d0c79e24f71b1698d6784ad6
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    * src/editfns.c (Fformat): Fix use-after-free bug (Bug#20548).
---
 src/editfns.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/editfns.c b/src/editfns.c
index 1686fbf..cddb0d4 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -4390,9 +4390,6 @@ usage: (format STRING &rest OBJECTS)  */)
     nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf);
   val = make_specified_string (buf, nchars, p - buf, multibyte);
 
-  /* If we allocated BUF with malloc, free it too.  */
-  SAFE_FREE ();
-
   /* If the format string has text properties, or any of the string
      arguments has text properties, set up text properties of the
      result string.  */
@@ -4498,6 +4495,9 @@ usage: (format STRING &rest OBJECTS)  */)
       UNGCPRO;
     }
 
+  /* If we allocated BUF or INFO with malloc, free it too.  */
+  SAFE_FREE ();
+
   return val;
 }
 



reply via email to

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