diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2017-02-02 09:33:04 +1300 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2017-02-02 09:33:04 +1300 |
| commit | 1ed246aedde91f1deba237404fb8bda2904c20a2 (patch) | |
| tree | 18b53f59469a20238aceb7d15c0a536288e1fff9 /man3 | |
| parent | 5d048f53d3daf21d8e49b98c931c7d73f2abc669 (diff) | |
| download | man-pages-1ed246aedde91f1deba237404fb8bda2904c20a2.tar.gz | |
printf.3: Fix a small bug in example code
Move the second call to va_end(ap) to above the if-block that
precedes it, so that the va_list 'ap' will be cleaned up in
all cases.
Reported-by: Erik Roland van der Meer <ervdmeer@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man3')
| -rw-r--r-- | man3/printf.3 | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/man3/printf.3 b/man3/printf.3 index c9e6bdad9c..c220ba78e6 100644 --- a/man3/printf.3 +++ b/man3/printf.3 @@ -1157,11 +1157,12 @@ make_message(const char *fmt, ...) va_start(ap, fmt); size = vsnprintf(p, size, fmt, ap); + va_end(ap); + if (size < 0) { free(p); return NULL; } - va_end(ap); return p; } |
