[PATCH 4/6] tests/kms_flip: don't leak the CRTC

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

 



From: Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx>

The kms_flip program calls kmstest_get_connector_config, which returns
a struct containing some allocated variables, including a pointer to
the CRTC. The problem is that we copy the values returned by this
structure to the test_output struct, but we ignore the CRTC pointer.
So free the CRTC pointer instead of leaking it.

Caught by Valgrind.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx>
---
 tests/kms_flip.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 80f4d76..78e179e 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -921,6 +921,8 @@ static void connector_find_preferred_mode(uint32_t connector_id, int crtc_idx,
 
 	o->fb_width = o->kmode[0].hdisplay;
 	o->fb_height = o->kmode[0].vdisplay;
+
+	drmModeFreeCrtc(config.crtc);
 }
 
 static bool mode_compatible(const drmModeModeInfo *a, const drmModeModeInfo *b)
@@ -986,6 +988,9 @@ found:
 	o->kencoder[1] = config[1].encoder;
 	o->_crtc[1] = config[1].crtc->crtc_id;
 	o->kmode[1] = *mode[1];
+
+	drmModeFreeCrtc(config[0].crtc);
+	drmModeFreeCrtc(config[1].crtc);
 }
 
 static void paint_flip_mode(struct kmstest_fb *fb, bool odd_frame)
-- 
1.8.3.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux