[brasero/gnome-2-28] Fix #605433 - [PATCH] Fix some leaks in the CAM code Patch by Joe Marcus Clarke



commit baadba1b7de544b53787d2fe7e73ab44cd0a72d3
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Thu Jan 7 17:33:12 2010 +0100

    Fix #605433 -  [PATCH] Fix some leaks in the CAM code
    Patch by Joe Marcus Clarke

 libbrasero-media/scsi-cam.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/libbrasero-media/scsi-cam.c b/libbrasero-media/scsi-cam.c
index 9d2f2ad..d9370f2 100644
--- a/libbrasero-media/scsi-cam.c
+++ b/libbrasero-media/scsi-cam.c
@@ -184,6 +184,8 @@ brasero_device_handle_open (const gchar *path,
 		handle->fd = fd;
 	}
 	else {
+		int serrno;
+
 		if (code) {
 			if (errno == EAGAIN
 			||  errno == EWOULDBLOCK
@@ -193,6 +195,15 @@ brasero_device_handle_open (const gchar *path,
 				*code = BRASERO_SCSI_ERRNO;
 		}
 
+		serrno = errno;
+
+		if (fd > -1)
+			close (fd);
+		if (cam)
+			cam_close_device (cam);
+
+		errno = serrno;
+
 		return NULL;
 	}
 



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