On 17/03/11 08:13, Stefan Kost wrote:

> What matters is the last line. When *not* run under valgrind the
> addresses are the same. When run under valgrind I get a couple of
> ==1989== Invalid read of size 1
> ==1989==    at 0x41C9B33: vfprintf (vfprintf.c:1614)
> ==1989==    by 0x41D0ACF: printf (printf.c:35)
> ==1989==    by 0x8048785: main (udevcls.c:57)
> ==1989==  Address 0x4358b58 is 0 bytes inside a block of size 16 free'd
> ==1989==    at 0x40267ED: free (vg_replace_malloc.c:366)
> ==1989==    by 0x42EA335: ??? (in /lib/libudev.so.0.9.1)
> ==1989==    by 0x42EB38E: ??? (in /lib/libudev.so.0.9.1)
> ==1989==    by 0x42EB7A0: udev_device_get_devnode (in /lib/libudev.so.0.9.1)
> ==1989==    by 0x404A965: g_udev_device_get_device_file (in
> /usr/lib/libgudev-1.0.so.0.0.1)
> ==1989==    by 0x804873A: main (udevcls.c:56)

In other words you have a printf that is printing data from a block of
memory that has been freed - a bug in your code.

Valgrind has told you exactly what is wrong - time to go and fix it ;-)

Tom

-- 
Tom Hughes ([email protected])
http://compton.nu/

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to