alloca: one step towards thread-safety
[pspp] / lib / vdprintf.c
index 2b0da8a2892bd7c98acedc009dc28899c000856e..008738a15617b0e4878755c2d198e7fbb5f71b4d 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to a file descriptor.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -54,6 +54,9 @@ vdprintf (int fd, const char *format, va_list args)
       return -1;
     }
 
+  if (output != buf)
+    free (output);
+
   if (len > INT_MAX)
     {
       errno = EOVERFLOW;