c - Different outputs in Valgrind across multiple machines -
in machine a
reason bunch of:
==21855== invalid read of size 4 ==21855== @ 0x422a26f: ??? (in /lib/i686/cmov/libc-2.11.3.so) ==21855== 0x4216e2f: vsnprintf (in /lib/i686/cmov/libc-2.11.3.so) ==21855== 0x41fe421: snprintf (in /lib/i686/cmov/libc-2.11.3.so) ==21855== 0x804f95b: put_lines (lines.c:354) ==21855== 0x805076b: examine_lines (lines.c:658) ==21855== 0x80509d8: read_lines (lines.c:715) ==21855== 0x804eed0: main (app.c:564) ==21855== address 0x444230c 12 bytes inside block of size 13 alloc'd ==21855== @ 0x40255bc: malloc (vg_replace_malloc.c:270) ==21855== 0x804ff80: read_str (lines.c:464) ==21855== 0x80501a2: read_type (lines.c:522) ==21855== 0x8050663: examine_lines (lines.c:631) ==21855== 0x80509d8: read_lines (lines.c:715) ==21855== 0x804eed0: main (app.c:564) ==21855== ==21855== conditional jump or move depends on uninitialised value(s) ==21855== @ 0x422a27d: ??? (in /lib/i686/cmov/libc-2.11.3.so) ==21855== 0x804f9a8: put_lines (lines.c:364) ==21855== 0x805076b: examine_lines (lines.c:658) ==21855== 0x80509d8: read_lines (lines.c:715) ==21855== 0x804eed0: main (app.c:564) ==21855== uninitialised value created stack allocation ==21855== @ 0x804f8f2: put_lines (lines.c:343)
running same valgrind command (even --leak-check=full
) in machine b
, don't errors
i'm using same valgrind version valgrind-3.8.1 in both machines.
same behavior when run other programs such as, htop (same version too).
valgrind --log-file="logfile" --tool=memcheck --leak-check=yes ./program
why happpen? , how can make valgrind consistent across machines?
update
code snippet:
void put_lines (char * name, char * date, char * month) { char main_str[2048]; snprintf(main_str, sizeof (main_str), "%s-%s-%s", name, date, month); main_str[sizeof(main_str)-1] = 0; // more code }
Comments
Post a Comment