On 06/21/2016 12:32 PM, Jo-Philipp Wich wrote: > Hi, > > first of all, thanks for putting work into that - I like the changes in > general. Have a few comments inline below. > > ~ Jo > >> Consistently handle allocation failures. Some functions are changed to >> return bool instead of void to allow returning an error. >> >> Also fix a buffer size miscalculation in lua/uloop. >> >> Signed-off-by: Matthias Schiffer <mschif...@universe-factory.net> >> --- [...] >> @@ -316,8 +323,13 @@ char *blobmsg_format_json_with_cb(struct blob_attr >> *attr, bool list, blobmsg_jso >> return NULL; >> } >> >> - s.buf = realloc(s.buf, s.pos + 1); >> - s.buf[s.pos] = 0; >> + ret = realloc(s.buf, s.pos + 1); >> + if (!ret) { >> + free(s.buf); >> + return NULL; >> + } >> >> - return s.buf; >> + ret[s.pos] = 0; > > Did you forget to assign "ret" to "s.buf" here? This one is correct as is, s is a local variable, so assigning it at the end doesn't make sense.
> >> + >> + return ret; >> } [...] Thanks for having a look, I'll fix up the rest. Matthias
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev