On Wed, 27 Feb 2013, Martin Kosek wrote:
On 02/27/2013 12:35 PM, Sumit Bose wrote:
Hi,

the attached patches 102-107 fix issues found by Coverity which are
tracked by tickets #3422-#3427 and remove an unused variable
(patch 101).

bye,
Sumit


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 6.5.3.4 for details.

It is a common idiom to do foo = (foo_t*) malloc(sizeof(*foo));


--
/ Alexander Bokovoy

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to