[PATCH:xrdb 2/3] Replace complex malloc calculations with asprintf()

Alan Coopersmith alan.coopersmith at oracle.com
Thu Jan 6 14:24:15 PST 2011

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.

Thanks for the review, revised patch follows.

	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System

More information about the xorg-devel mailing list