On Thu, Mar 22, 2007 at 05:13:35PM +0000, Mark McLoughlin wrote:
On Thu, 2007-03-22 at 13:01 -0400, Daniel Veillard wrote:
> Index: qemud/iptables.c
Hmm, this stuff is already in one of the patches I sent.
>
> - if (!(argv = (char **)malloc(sizeof(char *) * (n+1))))
> + if (!(argv = (char **)calloc(1, sizeof(char *) * (n + 1))))
I'd do:
if (!(argv = (char **)calloc(n + 1, sizeof(char *))))
Unless, of course, you're just being ironic about how stupid it is that
we have calloc() rather than malloc0() ... in which case I thoroughly
approve :-)
no irony ... robotic, just s+malloc(+calloc(1, + in the right
contexts
Same thing elsewhere in the patch e.g.
> - if (!(*argv = malloc(len * sizeof(char *))))
> + if (!(*argv = calloc(1, len * sizeof(char *))))
should be:
if (!(*argv = calloc(len, sizeof(char *))))
okay, will do,
Daniel
--
Red Hat Virtualization group
http://redhat.com/virtualization/
Daniel Veillard | virtualization library
http://libvirt.org/
veillard(a)redhat.com | libxml GNOME XML XSLT toolkit
http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine
http://rpmfind.net/