summaryrefslogtreecommitdiff
path: root/ext/fileinfo/libmagic/print.c
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2015-01-26 11:52:53 +0100
committerOndřej Surý <ondrej@sury.org>2015-01-26 11:52:53 +0100
commit832b62efb8fceebb220116d8024d945a9bd31d7e (patch)
treee3c65d02b50180c7d7d7c21626d403d2eb87793a /ext/fileinfo/libmagic/print.c
parent60fede4c90746ef3408ed27a15dd405b3a46a83b (diff)
downloadphp-832b62efb8fceebb220116d8024d945a9bd31d7e.tar.gz
New upstream version 5.6.5+dfsgupstream/5.6.5+dfsg
Diffstat (limited to 'ext/fileinfo/libmagic/print.c')
-rw-r--r--ext/fileinfo/libmagic/print.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/fileinfo/libmagic/print.c b/ext/fileinfo/libmagic/print.c
index eb4e6e8ce..26bb2f7e9 100644
--- a/ext/fileinfo/libmagic/print.c
+++ b/ext/fileinfo/libmagic/print.c
@@ -59,16 +59,19 @@ protected void
file_magwarn(struct magic_set *ms, const char *f, ...)
{
va_list va;
- char *expanded_format;
+ char *expanded_format = NULL;
+ int expanded_len;
TSRMLS_FETCH();
va_start(va, f);
- if (vasprintf(&expanded_format, f, va)); /* silence */
+ expanded_len = vasprintf(&expanded_format, f, va);
va_end(va);
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);
+ if (expanded_len >= 0 && expanded_format) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);
- free(expanded_format);
+ free(expanded_format);
+ }
}
protected const char *