[freetds] valgrind fails

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Mon Aug 16 06:08:58 EDT 2004


Here are some error reported by valgrind...

==23146== Memcheck, a.k.a. Valgrind, a memory error detector for
x86-linux.
==23146== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==23146== Using valgrind-2.0.0, a program supervision framework for
x86-linux.
==23146== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
....
ct_results() result_type CS_CMD_FAIL.
==23146== Conditional jump or move depends on uninitialised value(s)
==23146==    at 0x40222471: blk_rowxfer_mult (blk.c:556)
==23146==    by 0x8048E5B: main (blk_out.c:145)
==23146==    by 0x4D1EDB7E: __libc_start_main (in
/lib/i686/libc-2.3.2.so)
==23146==    by 0x8048A9C: (within
/home/freddy/cpp/freetds/freetds63/src/ctlib/unittests/.libs/blk_out)
blk_out.c: Retrieve data using array binding 
retrieved 1 (4,0) AAAA (5,0) Jan  1 2002 10:00AM (20,0)
retrieved 2 (4,0) BBBB (5,0) Jan  2 2002 10:00AM (20,0)
retrieved 3 (4,0) CCCC (5,0) Jan  3 2002 10:00AM (20,0)
retrieved 8 (4,0) DDDD (5,0) Jan  4 2002 10:00AM (20,0)
retrieved 3 (0,-1) EEEE (5,0) Jan  5 2002 10:00AM (20,0)
...
==23146== 
==23146== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 9 from 1)
==23146== 
==23146== 1 errors in context 1 of 1:
==23146== Conditional jump or move depends on uninitialised value(s)
==23146==    at 0x40222471: blk_rowxfer_mult (blk.c:556)
==23146==    by 0x8048E5B: main (blk_out.c:145)
==23146==    by 0x4D1EDB7E: __libc_start_main (in
/lib/i686/libc-2.3.2.so)
==23146==    by 0x8048A9C: (within
/home/freddy/cpp/freetds/freetds63/src/ctlib/unittests/.libs/blk_out)
--23146-- 

In blk.c (ctlib) we read *row_count but in blk_out.c (unittests) count
it's not initialized. Should count be initialized or it's a problem in
ctlib (that shouldn't undefer the pointer) ??


--23146-- supp:    9 dl_relocate/dl_open_worker
==23146== 
==23146== IN SUMMARY: 1 errors from 1 contexts (suppressed: 9 from 1)
==23146== 
==23146== malloc/free: in use at exit: 3544 bytes in 14 blocks.
==23146== malloc/free: 314 allocs, 300 frees, 358118 bytes allocated.
==23146== 
==23146== searching for pointers to 14 not-freed blocks.
==23146== checked 3851696 bytes.
==23146== 
==23146== 
==23146== 36 bytes in 1 blocks are definitely lost in loss record 6 of 8
==23146==    at 0x4001368E: malloc (vg_replace_malloc.c:153)
==23146==    by 0x4022180D: blk_alloc (blk.c:64)
==23146==    by 0x8048C82: main (blk_out.c:82)
==23146==    by 0x4D1EDB7E: __libc_start_main (in
/lib/i686/libc-2.3.2.so)
==23146==    by 0x8048A9C: (within
/home/freddy/cpp/freetds/freetds63/src/ctlib/unittests/.libs/blk_out)
==23146== 
...

Test does not free bulk data or it's a ctlib leak ??

PASS: blk_out




==23329== Memcheck, a.k.a. Valgrind, a memory error detector for
x86-linux.
==23329== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==23329== Using valgrind-2.0.0, a program supervision framework for
x86-linux.
==23329== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
...
Msg 3701, Level 11, State 5
Server 'OPDN106', Line 1
Cannot drop the procedure '#t0022', because it does not exist in the
system catalog.
==23329== Syscall param socketcall.send(msg) contains uninitialised or
unaddressable byte(s)
==23329==    at 0x4D2B64C6: __libc_send (in /lib/i686/libc-2.3.2.so)
==23329==    by 0x402331BA: tds_flush_packet (write.c:415)
==23329==    by 0x4023B66A: tds_submit_rpc (query.c:1494)
==23329==    by 0x40223FAE: dbrpcsend (rpc.c:253)
==23329==    by 0x804922E: main (rpc.c:155)
==23329==    by 0x4D1EDB7E: __libc_start_main (in
/lib/i686/libc-2.3.2.so)
==23329==    by 0x8048E40: (within
/home/freddy/cpp/freetds/freetds63/src/dblib/unittests/.libs/rpc)
==23329==    Address 0x41143AE5 is 73 bytes inside a block of size 4096
alloc'd
==23329==    at 0x40013C02: realloc (vg_replace_malloc.c:310)
==23329==    by 0x40229CE4: tds_realloc_socket (mem.c:756)
==23329==    by 0x4022E6C9: tds_process_env_chg (token.c:2336)
==23329==    by 0x4022B919: tds_process_default_tokens (token.c:115)
==23329==    by 0x4022BBD0: tds_process_login_tokens (token.c:373)
==23329==    by 0x40230CAA: tds_connect (login.c:360)
==23329==    by 0x4021E114: tdsdbopen (dblib.c:978)
==23329==    by 0x8049130: main (rpc.c:121)
==23329==    by 0x4D1EDB7E: __libc_start_main (in
/lib/i686/libc-2.3.2.so)
==23329==    by 0x8048E40: (within
/home/freddy/cpp/freetds/freetds63/src/dblib/unittests/.libs/rpc)

This it's really weird !!! Who did fill the buffer ??


found OPDN106.test for test in "../../../PWD"
Start
About to logon
About to open OPDN106.test
Dropping procedure #t0022
Creating procedure #t0022
executing dbrpcinit
executing dbrpcparam
executing dbrpcparam
executing dbrpcsend
executing dbsqlok
bound 1 of 1 columns ('type') in result 1.
	type
	-----------
	char
	int
	text
retrieving return status... none
retrieving output parameter... none
bound 1 of 1 columns ('name') in result 2.
	name
	-----------
	syscolumns
	syscomments
	sysdepends
	sysfilegroups
	sysfiles
	sysfiles1
	sysforeignkeys
	sysfulltextcatalogs
	sysfulltextnotify
	sysindexes
	sysindexkeys
	sysmembers
	sysobjects
	syspermissions
	sysproperties
	sysprotects
	sysreferences
	systypes
	sysusers
retrieving return status... 42
retrieving output parameter... ret name 1 is @first_type
ret type 1 is 47
ret len 1 is 64
ret data 1 is bigint
ret name 2 is @nrows
ret type 2 is 56
ret len 2 is 4
ret data 2 is 3
done
Dropping procedure
dblib okay on rpc.c
...
==23329== 
==23329== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 9 from 1)
==23329== 
==23329== 1 errors in context 1 of 1:
==23329== Syscall param socketcall.send(msg) contains uninitialised or
unaddressable byte(s)
==23329==    at 0x4D2B64C6: __libc_send (in /lib/i686/libc-2.3.2.so)
==23329==    by 0x402331BA: tds_flush_packet (write.c:415)
==23329==    by 0x4023B66A: tds_submit_rpc (query.c:1494)
==23329==    by 0x40223FAE: dbrpcsend (rpc.c:253)
==23329==    by 0x804922E: main (rpc.c:155)
==23329==    by 0x4D1EDB7E: __libc_start_main (in
/lib/i686/libc-2.3.2.so)
==23329==    by 0x8048E40: (within
/home/freddy/cpp/freetds/freetds63/src/dblib/unittests/.libs/rpc)
==23329==    Address 0x41143AE5 is 73 bytes inside a block of size 4096
alloc'd
==23329==    at 0x40013C02: realloc (vg_replace_malloc.c:310)
==23329==    by 0x40229CE4: tds_realloc_socket (mem.c:756)
==23329==    by 0x4022E6C9: tds_process_env_chg (token.c:2336)
==23329==    by 0x4022B919: tds_process_default_tokens (token.c:115)
==23329==    by 0x4022BBD0: tds_process_login_tokens (token.c:373)
==23329==    by 0x40230CAA: tds_connect (login.c:360)
==23329==    by 0x4021E114: tdsdbopen (dblib.c:978)
==23329==    by 0x8049130: main (rpc.c:121)
==23329==    by 0x4D1EDB7E: __libc_start_main (in
/lib/i686/libc-2.3.2.so)
==23329==    by 0x8048E40: (within
/home/freddy/cpp/freetds/freetds63/src/dblib/unittests/.libs/rpc)
--23329-- 
--23329-- supp:    9 dl_relocate/dl_open_worker
==23329== 
==23329== IN SUMMARY: 1 errors from 1 contexts (suppressed: 9 from 1)
==23329== 
==23329== malloc/free: in use at exit: 220930 bytes in 74 blocks.
==23329== malloc/free: 335 allocs, 261 frees, 372944 bytes allocated.
==23329== 
==23329== searching for pointers to 74 not-freed blocks.
==23329== checked 3903504 bytes.
==23329== 
==23329== 
==23329== 4 bytes in 1 blocks are definitely lost in loss record 1 of 24
==23329==    at 0x4001368E: malloc (vg_replace_malloc.c:153)
==23329==    by 0x4021DAB2: dblogin (dblib.c:566)
==23329==    by 0x80490D0: main (rpc.c:113)
==23329==    by 0x4D1EDB7E: __libc_start_main (in
/lib/i686/libc-2.3.2.so)
==23329==    by 0x8048E40: (within
/home/freddy/cpp/freetds/freetds63/src/dblib/unittests/.libs/rpc)
==23329== 
...
PASS: rpc


freddy77



More information about the FreeTDS mailing list