Re: [libdc1394-devel] Valgrind and libdc1394 (Patch)
Capture and control API for IIDC compliant cameras
Brought to you by:
ddouxchamps,
gordp
From: Pablo A. M. <pal...@go...> - 2006-12-18 03:53:24
|
Hello, here is the patch for the 1.2.x version. Most Valgrind warnings in our cod= e=20 are now gone with the variable initializations made here. The patch should= =20 work with the version 1 in the repository. Only the dc1394_control.c file= =20 has been affected. To apply it: cd $(PATH_TO_YOUR)/libdc1394/branches/Version_1/libdc1394/libdc1394 cat dc1394_control.c.patch | patch -p0=20 Regards, Pablo On Sunday, 10 de December de 2006 11:21, Pablo Alvarado Moya wrote: > Hello everybody, > > I'm improving a wrapper class for the libdc1394 in the LTI-Lib (image > processing library), and while testing my classes for memory leaks and > alike using Valgrind, I found that the libdc1394 version 1.2.1 (the one on > SourceForge) generates lots of dangerous warnings like: > > Conditional jump or move depends on uninitialised value(s) > =3D=3D22706=3D=3D at 0x4332CD4: GetConfigROMTaggedRegister > (dc1394_control.c:878) =3D=3D22706=3D=3D by 0x43332EC: dc1394_get_came= ra_info > (dc1394_control.c:1360) ... > > Otherwise than the compiler, Valgrind has detected that the condition in > the "if"s is really based on uninitialized values. Some of the warnings > can be avoided initializing all attributes of the structures used, before > calling any dc1394_* function, but others are based on internal unitializ= ed > variables within the library. > > Would it be possible in the function (in dc1394_control.c) > > int GetCameraControlRegister(raw1394handle_t handle, nodeid_t node, > octlet_t offset,quadlet_t > *value) > > to force at the beginning *value=3D0 ? This would eliminate many of the > warnings, as the cases in which value isn't touched will provide somethin= g. > (This is a critical case, I could also change the many cases which call > this function and force them to initialize value instead). > > Also in int dc1394_get_camera_info(...) many warnings are produced since > > quadlet_t value[2], quadval; > > are not initialized. > > I can create a patch if anybody is interested in. However, I wanted to as > if those initializations have implications that I overlook. > > Regards, > > Pablo =2D-=20 Dr. Pablo Alvarado E-Mail: pal...@ie... Escuela de Ingenier=EDa Electr=F3nica Tel.: (+506) 550 2106 Instituto Tecnol=F3gico de Costa Rica Fax.: (+506) 591 6629 Apartado Postal 159-7050 Cartago Costa Rica |