|
From: <an...@cl...> - 2005-07-27 16:27:15
|
Hi, I'm trying to track down memory leaks with Valgrind, but I'm experiencing troubles using it. This is my first experience with Valgrind so I'm a little bit lost here. The problem is that running my program using Valgrind makes the if_indextoname function (declared as extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW; in net/if.h) return NULL with the following error in the output: ==10869== Syscall param ioctl(SIOCGIFNAME) points to unaddressable byte(s) ==10869== at 0x1B9EF114: ioctl (in /lib/tls/libc-2.3.2.so) ==10869== by 0x8048478: main (test.c:14) ==10869== Address 0x2 is not stack'd, malloc'd or (recently) free'd whereas it returns the expected value when running the program alone. I suppressed the error as explained in the manual (so, no error on the output) but the if_indextoname function still returns NULL when the program is launched with Valgrind. How can this be avoided? Thx in advance for your help, Martin |
|
From: Dennis L. <pla...@in...> - 2005-07-29 07:39:31
|
At 18:27 27.07.2005, Martin Andr=E9 wrote: >Hi, > >I'm trying to track down memory leaks with Valgrind, but I'm experiencing= =20 >troubles using it. This is my first experience with Valgrind so I'm a=20 >little bit lost here. > >The problem is that running my program using Valgrind makes the=20 >if_indextoname function (declared as extern char *if_indextoname (unsigned= =20 >int __ifindex, char *__ifname) __THROW; in net/if.h) return NULL with the= =20 >following error in the output: > >=3D=3D10869=3D=3D Syscall param ioctl(SIOCGIFNAME) points to unaddressable= byte(s) >=3D=3D10869=3D=3D at 0x1B9EF114: ioctl (in /lib/tls/libc-2.3.2.so) >=3D=3D10869=3D=3D by 0x8048478: main (test.c:14) >=3D=3D10869=3D=3D Address 0x2 is not stack'd, malloc'd or (recently)= free'd You are passing an invalid parameter to the syscall, thus 0 is returned.=20 Check if the parameters to if_indextoname are valid prior to calling it Carpe quod tibi datum est=20 |