[PATCH libdrm 1/5] modetest: fix Segmentation fault

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

 



If use -P option without -s option, we meet Segmentation fault error
when modetest is terminated. Check whether dev.mode.bo is NULL.

Signed-off-by: Joonyoung Shim <jy0922.shim@xxxxxxxxxxx>
---
 tests/modetest/modetest.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 5f46efd..b59f6b5 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -1113,6 +1113,12 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co
 	dev->mode.fb_id = fb_id;
 }
 
+static void clear_mode(struct device *dev)
+{
+	if (dev->mode.bo)
+		bo_destroy(dev->mode.bo);
+}
+
 static void set_planes(struct device *dev, struct plane_arg *p, unsigned int count)
 {
 	unsigned int i;
@@ -1636,7 +1642,8 @@ int main(int argc, char **argv)
 		if (test_cursor)
 			clear_cursors(&dev);
 
-		bo_destroy(dev.mode.bo);
+		if (count)
+			clear_mode(&dev);
 	}
 
 	free_resources(dev.resources);
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux