[PATCH 2/5 libdrm] modetest: fix memory leak
Paulo Zanoni
przanoni at gmail.com
Tue Mar 20 07:51:27 PDT 2012
From: Paulo Zanoni <paulo.r.zanoni at intel.com>
Don't "continue" without freeing the connector.
192 bytes in 6 blocks are indirectly lost in loss record 6 of 12
at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x4E30DD8: drmMalloc (xf86drm.c:147)
by 0x4E35024: drmAllocCpy (xf86drmMode.c:73)
by 0x4E35D69: drmModeGetConnector (xf86drmMode.c:507)
by 0x402F22: dump_connectors (modetest.c:181)
by 0x40261B: main (modetest.c:801)
Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
---
tests/modetest/modetest.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index c0f7ad7..2779d4f 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -198,17 +198,16 @@ void dump_connectors(void)
printf("%s%d", j > 0 ? ", " : "", connector->encoders[j]);
printf("\n");
- if (!connector->count_modes)
- continue;
-
- printf(" modes:\n");
- printf(" name refresh (Hz) hdisp hss hse htot vdisp "
- "vss vse vtot)\n");
- for (j = 0; j < connector->count_modes; j++)
- dump_mode(&connector->modes[j]);
-
- printf(" props:\n");
- dump_props(connector);
+ if (connector->count_modes) {
+ printf(" modes:\n");
+ printf(" name refresh (Hz) hdisp hss hse htot vdisp "
+ "vss vse vtot)\n");
+ for (j = 0; j < connector->count_modes; j++)
+ dump_mode(&connector->modes[j]);
+
+ printf(" props:\n");
+ dump_props(connector);
+ }
drmModeFreeConnector(connector);
}
--
1.7.9.1
More information about the dri-devel
mailing list