com php-src: emalloc never returns null: ext/xmlrpc/libxmlrpc/encodings.c

From: Date: Wed, 13 Jun 2018 14:00:41 +0000
Subject: com php-src: emalloc never returns null: ext/xmlrpc/libxmlrpc/encodings.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-102144@lists.php.net to get a copy of this message
Commit: 10a9c5194222c3ebdb740a366056092f0e3a62d5 Author: Markus Staab <maggus.staab@googlemail.com> Wed, 13 Jun 2018 12:27:57 +0200 Committer: Christoph M. Becker <cmbecker69@gmx.de> Wed, 13 Jun 2018 16:00:41 +0200 Parents: 128cd0d0f2dd07c5331d609f1906c5e4fe3e9f98 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=10a9c5194222c3ebdb740a366056092f0e3a62d5 Log: emalloc never returns null Changed paths: M ext/xmlrpc/libxmlrpc/encodings.c Diff: diff --git a/ext/xmlrpc/libxmlrpc/encodings.c b/ext/xmlrpc/libxmlrpc/encodings.c index 5777152..a2e6ff1 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; } } }

« previous php.cvs (#102144) next »