On Thursday, February 03, 2011, Tom Hughes wrote:
> On 03/02/11 10:13, Baurzhan Ismagulov wrote:
> > On Thu, Feb 03, 2011 at 09:13:56AM +0000, Tom Hughes wrote:
> >>>> In my function, I definitely initialize every value in the structure
> >>>> (both by clearing with memset and also individually), but I still get
> >>>> this message.
> >>> 
> >>> Assuming that msgp is f_msg *, I fail to see mtext in f_msg. Is it the
> >>> right struct?
> >> 
> >> No, he is passing that struct as mtext.
> >> 
> >> The problem is that the struct has padding, which he won't be
> >> initialising.
> > 
> > I assume he memsets the whole struct, so padding should also be
> > initialized?
> 
> Why would you presume that? I would say that it's pretty clear that he
> isn't, or he wouldn't get the warning from valgrind!

Well, he did say that in the original msg, although it's ambiguous.
If the whole struct is memset-0'd then the padding should all be
initialised.  memset-0-ing the fields individually obviously won't
help.

Steve, try (1) memset-0-ing the entire structure, and (2) using
--track-origins=yes.

J

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to