summaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/Makefile2
-rw-r--r--stdio-common/bug21.c16
-rw-r--r--stdio-common/vfscanf.c1
3 files changed, 17 insertions, 2 deletions
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index d5b1251993..db622af22b 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -57,7 +57,7 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 bug15 \
tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
- bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20
+ bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21
test-srcs = tst-unbputc tst-printf
diff --git a/stdio-common/bug21.c b/stdio-common/bug21.c
new file mode 100644
index 0000000000..d22b9c1a97
--- /dev/null
+++ b/stdio-common/bug21.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ static const char buf[] = " ";
+ char *str;
+
+ int r = sscanf (buf, "%as", &str);
+ printf ("%d %p\n", r, str);
+
+ return r != -1 || str != NULL;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index f550109a90..a03e19c4e3 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -2845,7 +2845,6 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
*p->ptrs[cnt] = NULL;
}
p = p->next;
- free (ptrs_to_free);
ptrs_to_free = p;
}
}