[SSSD] [PATCH] ELAPI: Ticket 161: Initialize structures with calloc instead of enumerating members

Jakub Hrozek jhrozek at redhat.com
Sun Sep 20 11:21:38 UTC 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/18/2009 08:57 PM, Dmitri Pal wrote:
> After reflecting on the matter a bit (while Steven was holding the
> mirror) I suggest a Nack.
> There are other places that need to be looked at.
> 
> ./providers/file/file_fmt_csv.c:    cfg = (struct file_csv_cfg
> *)malloc(sizeof(struct file_csv_cfg));

OK, I spotted this one before and thought we didn't need a calloc b/c
all the structure members are initialized later on. But I guess it can't
hurt, esp. when extending the structure.

> ./elapi_log.c:    handle = (struct elapi_dispatcher *)
> malloc(sizeof(struct elapi_dispatcher));

Done. We did a malloc&memset, but calloc is cleaner solution I guess

> 
> Please use grep malloc across the whole elapi tree and check if I missed
> something too.

done, only string allocation and similar.

New patch is attached,
	Jakub
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkq2EDgACgkQHsardTLnvCXsYgCgs234InwsUfILetw10FBDivbB
qxsAoK4MXtDUXwkLB5Wjc93lqtFUX40t
=SUBc
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ELAPI-Ticket-161-Initialize-structures-with-calloc.patch
Type: text/x-patch
Size: 5489 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20090920/190e4719/attachment.bin>


More information about the sssd-devel mailing list