[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libvir] memory error in another test



Running tests under valgrind exposed this:
(line numbers are slightly off, due to local changes)

==27876== ERROR SUMMARY: 32 errors from 2 contexts (suppressed: 5 from 2)
==27876==
==27876== 16 errors in context 1 of 2:
==27876== Conditional jump or move depends on uninitialised value(s)
==27876==    at 0x41BA18: qemudBuildCommandLine (qemu_conf.c:1871)
==27876==    by 0x406764: testCompareXMLToArgvFiles (qemuxml2argvtest.c:46)
==27876==    by 0x4069DA: testCompareXMLToArgvHelper (qemuxml2argvtest.c:97)
==27876==    by 0x406D60: virtTestRun (testutils.c:69)
==27876==    by 0x406A46: main (qemuxml2argvtest.c:114)
==27876==
==27876== 16 errors in context 2 of 2:
==27876== Conditional jump or move depends on uninitialised value(s)
==27876==    at 0x41AA45: qemudBuildCommandLine (qemu_conf.c:1606)
==27876==    by 0x406764: testCompareXMLToArgvFiles (qemuxml2argvtest.c:46)
==27876==    by 0x4069DA: testCompareXMLToArgvHelper (qemuxml2argvtest.c:97)
==27876==    by 0x406D60: virtTestRun (testutils.c:69)
==27876==    by 0x406A46: main (qemuxml2argvtest.c:114)

Both of those are due to uses of uninitialized vm->migrateFrom[0].

Here's the fix:

	Avoid memory error in a test program.
	* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Initialize
	vm.migrateFrom[0], to avoid "read-uninitialized" error
	from within qemudBuildCommandLine.

Index: tests/qemuxml2argvtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/qemuxml2argvtest.c,v
retrieving revision 1.5
diff -u -p -r1.5 qemuxml2argvtest.c
--- tests/qemuxml2argvtest.c	21 Sep 2007 21:20:32 -0000	1.5
+++ tests/qemuxml2argvtest.c	17 Oct 2007 13:42:15 -0000
@@ -40,6 +40,7 @@ static int testCompareXMLToArgvFiles(con
     vm.qemuVersion = 0 * 1000 * 100 + (8 * 1000) + 1;
     vm.qemuCmdFlags = QEMUD_CMD_FLAG_VNC_COLON |
         QEMUD_CMD_FLAG_NO_REBOOT;
+    vm.migrateFrom[0] = '\0';

     vmdef->vncActivePort = vmdef->vncPort;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]