On Wed, 27 Feb 2013, Martin Kosek wrote:
On 02/27/2013 12:35 PM, Sumit Bose wrote:
the attached patches 102-107 fix issues found by Coverity which are
tracked by tickets #3422-#3427 and remove an unused variable
I see just one issue. In patch 0105:
- global_ipactx = (struct ipa_context *)malloc(sizeof(global_ipactx));
+ global_ipactx = (struct ipa_context *)malloc(sizeof(*global_ipactx));
I do not think this will work right. *global_ipactx will just de-reference
global_ipactxt and run sizeof on the result, right?
No, sizeof() is compile-time operator. Compiler will do proper type
inferring. See C11 184.108.40.206 for details.
It is a common idiom to do
foo = (foo_t*) malloc(sizeof(*foo));
/ Alexander Bokovoy
Freeipa-devel mailing list