1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
2001-12-06  Ulrich Drepper  <drepper@redhat.com>

	* libio/vasprintf.c (_IO_vasprintf): Free buffer on failure.
	* assert/assert.c: Check result of __asprintf call and don't use
	string if it failed.
	* assert/assert-perr.c: Likewise.
	* inet/rcmd.c: Likewise.
	* locale/programs/localedef.c (main): Check result of
	construct_output_path and exit if it failed.
	(construct_output_path): Check result of asprintf and mkdir calls and
	fail if they failed.
	* posix/getopt.c: Check result of __asprintf calls and fail if
	they failed.
	Patch by Dmitry V. Levin <ldv@alt-linux.org>.
This commit is contained in:
Ulrich Drepper
2001-12-06 08:49:08 +00:00
parent 1e06620a7b
commit 383bd1c503
7 changed files with 234 additions and 162 deletions

View File

@ -60,7 +60,10 @@ _IO_vasprintf (result_ptr, format, args)
sf._s._free_buffer = (_IO_free_type) free;
ret = _IO_vfprintf (&sf._sbf._f, format, args);
if (ret < 0)
return ret;
{
free (sf._sbf._f._IO_buf_base);
return ret;
}
/* Only use realloc if the size we need is of the same order of
magnitude then the memory we allocated. */
needed = sf._sbf._f._IO_write_ptr - sf._sbf._f._IO_write_base + 1;