On 16/01/15 19:23, Stanislav Malyshev wrote: > No C++ comments please. Fixed.(Will push afterwards) >> > if (buf.c) { >> > - *pbuf = buf.c; >> > + if(pbuf) { >> > + *pbuf = buf.c; >> > + } >> > result = buf.len; > I think if pbuf is null, it should return 0 immediately. The code you > provided would result in a memory leak if pbuf is NULL, since the > pointer to buf.c would be lost as soon as vspprintf exits.
So, at the start of the code, have if(!pbuf) { return 0; }? i.e; --snip-- PHPAPI size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) /* {{{ */ { if(!pbuf) { return 0; } smart_string buf = {0}; size_t result; xbuf_format_converter(&buf, 1, format, ap); --snip-- ? Let me know. Thanks, -- -- Joshua Rogers <https://internot.info/>
signature.asc
Description: OpenPGP digital signature