diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2013-12-30 20:50:46 +1300 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2014-01-02 11:49:15 +1300 |
| commit | b0e6462a0bedf1e291656bbd20ba74105f7adfbe (patch) | |
| tree | 20ad243a0fef1af5078d6d6832318f5a432659c9 /man3/printf.3 | |
| parent | d102a6739726d102ed05e4e95c8a9e005f2056ce (diff) | |
| download | man-pages-b0e6462a0bedf1e291656bbd20ba74105f7adfbe.tar.gz | |
printf.3: Fix memory link in snprintf() example
See http://stackoverflow.com/questions/19933479/snprintf-man-page-example-memory-leak
Reported-by: Arif Zaman <arifz@lums.edu.pk>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man3/printf.3')
| -rw-r--r-- | man3/printf.3 | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/man3/printf.3 b/man3/printf.3 index 20a3b5d8ca..12373f1ee7 100644 --- a/man3/printf.3 +++ b/man3/printf.3 @@ -1056,8 +1056,10 @@ make_message(const char *fmt, ...) /* Check error code */ - if (n < 0) + if (n < 0) { + free(p); return NULL; + } /* If that worked, return the string */ |
