about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2012-01-08 20:13:35 -0500
committerUlrich Drepper <drepper@gmail.com>2012-01-08 20:13:35 -0500
commit20b38e0301279a37a3f1e769843933bcc0d5f736 (patch)
treef57c789b9ce863d6c82e6297a51152cadd07ff3a
parentf5420cf0739d8eda529b0b4694826f9ccb828573 (diff)
downloadglibc-20b38e0301279a37a3f1e769843933bcc0d5f736.tar.gz
glibc-20b38e0301279a37a3f1e769843933bcc0d5f736.tar.xz
glibc-20b38e0301279a37a3f1e769843933bcc0d5f736.zip
sscanf always calls realloc
-rw-r--r--ChangeLog5
-rw-r--r--stdio-common/vfscanf.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f8efd9e2bc..be2eddca3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* stdio-common/vfscanf.c (_IO_vfscanf_internal): Use alloca when
+	appropriate.
+
 2012-01-08  Ulrich Drepper  <drepper@gmail.com>
 
 	* math/Makefile (tests): Add tst-CMPLX.
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 0e71deba22..e18a6c3bf5 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2006, 2007, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2007, 2010, 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -274,7 +274,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 	  CHAR_T *old = wp;						    \
 	  size_t newsize = (UCHAR_MAX + 1 > 2 * wpmax			    \
 			    ? UCHAR_MAX + 1 : 2 * wpmax);		    \
-	  if (use_malloc || __libc_use_alloca (newsize))		    \
+	  if (use_malloc || !__libc_use_alloca (newsize))		    \
 	    {								    \
 	      wp = realloc (use_malloc ? wp : NULL, newsize);		    \
 	      if (wp == NULL)						    \