about summary refs log tree commit diff
path: root/stdio-common/Makefile
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2020-07-09 21:52:24 +0000
committerJoseph Myers <joseph@codesourcery.com>2020-07-09 21:52:24 +0000
commit90663e9c814a919fa1fb41a878c06ef2fae58ed2 (patch)
tree1ad0ca625f237ddb83265ea21988dcec972abeb5 /stdio-common/Makefile
parentede56038e50235cd1ca7de3602c9491d3b84b49b (diff)
downloadglibc-90663e9c814a919fa1fb41a878c06ef2fae58ed2.tar.gz
glibc-90663e9c814a919fa1fb41a878c06ef2fae58ed2.tar.xz
glibc-90663e9c814a919fa1fb41a878c06ef2fae58ed2.zip
Fix memory leak in __printf_fp_l (bug 26215).
__printf_fp_l has a memory leak in the case of some I/O errors, where
both buffer and wbuffer have been malloced but the handling of I/O
errors only frees wbuffer.  This patch fixes this by moving the
declaration of buffer to an outer scope and ensuring that it is freed
when wbuffer is freed.

Tested for x86_64 and x86.
Diffstat (limited to 'stdio-common/Makefile')
-rw-r--r--stdio-common/Makefile11
1 files changed, 8 insertions, 3 deletions
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index dc3fd38a19..8475fd1f09 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -68,7 +68,8 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
 	 scanf14a scanf16a \
 	 tst-printf-bz25691 \
 	 tst-vfprintf-width-prec-alloc \
-	 tst-printf-fp-free
+	 tst-printf-fp-free \
+	 tst-printf-fp-leak
 
 
 test-srcs = tst-unbputc tst-printf tst-printfsz-islongdouble
@@ -80,12 +81,14 @@ tests-special += $(objpfx)tst-unbputc.out $(objpfx)tst-printf.out \
 		 $(objpfx)tst-vfprintf-width-prec-mem.out \
 		 $(objpfx)tst-printfsz-islongdouble.out \
 		 $(objpfx)tst-printf-bz25691-mem.out \
-		 $(objpfx)tst-printf-fp-free-mem.out
+		 $(objpfx)tst-printf-fp-free-mem.out \
+		 $(objpfx)tst-printf-fp-leak-mem.out
 generated += tst-printf-bz18872.c tst-printf-bz18872.mtrace \
 	     tst-printf-bz18872-mem.out \
 	     tst-vfprintf-width-prec.mtrace tst-vfprintf-width-prec-mem.out \
 	     tst-printf-bz25691.mtrace tst-printf-bz25691-mem.out \
-	     tst-printf-fp-free.mtrace tst-printf-fp-free-mem.out
+	     tst-printf-fp-free.mtrace tst-printf-fp-free-mem.out \
+	     tst-printf-fp-leak.mtrace tst-printf-fp-leak-mem.out
 endif
 
 tests-special += $(objpfx)tst-errno-manual.out
@@ -113,6 +116,8 @@ tst-printf-bz25691-ENV = \
   MALLOC_TRACE=$(objpfx)tst-printf-bz25691.mtrace
 tst-printf-fp-free-ENV = \
   MALLOC_TRACE=$(objpfx)tst-printf-fp-free.mtrace
+tst-printf-fp-leak-ENV = \
+  MALLOC_TRACE=$(objpfx)tst-printf-fp-leak.mtrace
 
 $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
 	$(SHELL) $< $(common-objpfx) '$(test-program-prefix)' > $@; \