[PATCH 4/8] Fix memory leaks

Tim Wiederhake twied at gmx.net
Mon Jul 16 07:02:48 PDT 2012


---
 libkms/intel.c   |    3 ++-
 libkms/nouveau.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libkms/intel.c b/libkms/intel.c
index 8b8249b..238bec7 100644
--- a/libkms/intel.c
+++ b/libkms/intel.c
@@ -101,7 +101,8 @@ intel_bo_create(struct kms_driver *kms,
 		pitch = (pitch + 512 - 1) & ~(512 - 1);
 		size = pitch * ((height + 4 - 1) & ~(4 - 1));
 	} else {
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err_free;
 	}
 
 	memset(&arg, 0, sizeof(arg));
diff --git a/libkms/nouveau.c b/libkms/nouveau.c
index 0e24a15..f12c672 100644
--- a/libkms/nouveau.c
+++ b/libkms/nouveau.c
@@ -102,7 +102,8 @@ nouveau_bo_create(struct kms_driver *kms,
 		pitch = (pitch + 512 - 1) & ~(512 - 1);
 		size = pitch * height;
 	} else {
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err_free;
 	}
 
 	memset(&arg, 0, sizeof(arg));
-- 
1.7.10.4



More information about the dri-devel mailing list