diff options
author | Markus Staab <maggus.staab@googlemail.com> | 2018-06-13 12:27:57 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2018-06-13 16:00:41 +0200 |
commit | 10a9c5194222c3ebdb740a366056092f0e3a62d5 (patch) | |
tree | cd34e423e209618acb20cbc7744bd906a424b648 | |
parent | 128cd0d0f2dd07c5331d609f1906c5e4fe3e9f98 (diff) | |
download | php-git-10a9c5194222c3ebdb740a366056092f0e3a62d5.tar.gz |
emalloc never returns null
-rw-r--r-- | ext/xmlrpc/libxmlrpc/encodings.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/ext/xmlrpc/libxmlrpc/encodings.c b/ext/xmlrpc/libxmlrpc/encodings.c index 5777152ea8..a2e6ff194b 100644 --- a/ext/xmlrpc/libxmlrpc/encodings.c +++ b/ext/xmlrpc/libxmlrpc/encodings.c @@ -67,26 +67,24 @@ static char* convert(const char* src, int src_len, int *new_len, const char* fro size_t st; outbuf = (char*)emalloc(outlen + 1); - if(outbuf) { - out_ptr = (char*)outbuf; - while(inlenleft) { - st = iconv(ic, (char**)&src, &inlenleft, &out_ptr, &outlenleft); - if(st == -1) { - if(errno == E2BIG) { - int diff = out_ptr - outbuf; - outlen += inlenleft; - outlenleft += inlenleft; - outbuf = (char*)erealloc(outbuf, outlen + 1); - if(!outbuf) { - break; - } - out_ptr = outbuf + diff; - } - else { - efree(outbuf); - outbuf = 0; + out_ptr = (char*)outbuf; + while(inlenleft) { + st = iconv(ic, (char**)&src, &inlenleft, &out_ptr, &outlenleft); + if(st == -1) { + if(errno == E2BIG) { + int diff = out_ptr - outbuf; + outlen += inlenleft; + outlenleft += inlenleft; + outbuf = (char*)erealloc(outbuf, outlen + 1); + if(!outbuf) { break; } + out_ptr = outbuf + diff; + } + else { + efree(outbuf); + outbuf = 0; + break; } } } |