diff options
author | Christopher Faylor <me@cgf.cx> | 2008-03-02 22:25:07 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2008-03-02 22:25:07 +0000 |
commit | 1264c4d4fa45be3ab77e8d384012312a53528ca7 (patch) | |
tree | 89191142bb8000ca6d50dd58c91894ed1c307753 /winsup/cygwin/smallprint.cc | |
parent | da061b9cd22f40f75d361462ba4ef84c84b997f1 (diff) | |
download | cygnal-1264c4d4fa45be3ab77e8d384012312a53528ca7.tar.gz cygnal-1264c4d4fa45be3ab77e8d384012312a53528ca7.tar.bz2 cygnal-1264c4d4fa45be3ab77e8d384012312a53528ca7.zip |
* smallprint.cc (__small_vsprintf): Free allocated buffer rather than pointer
into the buffer.
Diffstat (limited to 'winsup/cygwin/smallprint.cc')
-rw-r--r-- | winsup/cygwin/smallprint.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/winsup/cygwin/smallprint.cc b/winsup/cygwin/smallprint.cc index a56a340bd..2a7810c50 100644 --- a/winsup/cygwin/smallprint.cc +++ b/winsup/cygwin/smallprint.cc @@ -1,6 +1,7 @@ /* smallprint.cc: small print routines for WIN32 - Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2005, 2006, 2007 Red Hat, Inc. + Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008 + Red Hat, Inc. This file is part of Cygwin. @@ -195,17 +196,18 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) us = va_arg (ap, PUNICODE_STRING); wfillin: { - char *tmp; + char *tmpbuf; - if (!sys_wcstombs_alloc (&tmp, HEAP_NOTHEAP, us->Buffer, + if (!sys_wcstombs_alloc (&tmpbuf, HEAP_NOTHEAP, us->Buffer, us->Length / sizeof (WCHAR))) { s = "invalid UNICODE_STRING"; goto fillin; } + char *tmp = tmpbuf; for (i = 0; *tmp && i < n; i++) *dst++ = *tmp++; - free (tmp); + free (tmpbuf); } break; default: |