X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fvdprintf.c;h=c408e9a6015c6be33b7d24a1e4e6a75de75ae5d5;hb=135351c549050196b5c1322b3ab1e956565ab3d8;hp=37512ed7459193b813add00cd1843791c0b887cd;hpb=d464708e0dc6a758523c57a088aea56efb463b1f;p=gnulib.git diff --git a/lib/vdprintf.c b/lib/vdprintf.c index 37512ed74..c408e9a60 100644 --- a/lib/vdprintf.c +++ b/lib/vdprintf.c @@ -1,5 +1,5 @@ /* Formatted output to a file descriptor. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2011 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 @@ -46,14 +46,17 @@ vdprintf (int fd, const char *format, va_list args) if (full_write (fd, output, len) < len) { if (output != buf) - { - int saved_errno = errno; - free (output); - errno = saved_errno; - } + { + int saved_errno = errno; + free (output); + errno = saved_errno; + } return -1; } + if (output != buf) + free (output); + if (len > INT_MAX) { errno = EOVERFLOW;