[PATCH:xrdb 2/3] Replace complex malloc calculations with asprintf()
guillem at hadrons.org
Thu Jan 6 15:00:13 PST 2011
On Thu, 2011-01-06 at 14:24:15 -0800, Alan Coopersmith wrote:
> On 01/ 5/11 05:32 PM, Guillem Jover wrote:
> > This will make the return value be 1 less than written. And len should
> > be checked here too, in case this call failed, which could happen due to
> > memory exhaustion for example (depending on the implementation).
> Though in the specific case of xrdb, the calls only check if the return
> value is -1 or not, so being off by one doesn't matter here, I've gone
> ahead and fixed this, and the other issues you raised, so that it's
> correct if this gets copied into more apps or the callers get modified
> in the future.
If the second vsnprintf call fails then the returned value will be < -1,
which will not match against the error checks from the callers.
> Thanks for the review, revised patch follows.
The revised patch does not seem to differ from the original?
More information about the xorg-devel