[gnome-color-manager] Prevent a segfault if ppdOpenFile() fails for whatever reason



commit 6b856fa0566c43c6d69924c090e23399e6da6861
Author: Richard Hughes <richard hughsie com>
Date:   Thu Mar 4 09:05:22 2010 +0000

    Prevent a segfault if ppdOpenFile() fails for whatever reason

 src/gcm-device-cups.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/gcm-device-cups.c b/src/gcm-device-cups.c
index 6f1fb7b..643636d 100644
--- a/src/gcm-device-cups.c
+++ b/src/gcm-device-cups.c
@@ -90,10 +90,16 @@ gcm_device_cups_set_from_dest (GcmDevice *device, http_t *http, cups_dest_t dest
 	if (ppd_file_location == NULL) {
 		g_set_error (error, 1, 0, "Not adding device without PPD");
 		ret = FALSE;
-		goto out;	
+		goto out;
 	}
 
+	/* try to open PPD file */
 	ppd_file = ppdOpenFile (ppd_file_location);
+	if (ppd_file == NULL) {
+		g_set_error (error, 1, 0, "PPD open file failed");
+		ret = FALSE;
+		goto out;
+	}
 
 	for (i = 0; i < ppd_file->num_attrs; i++) {
 		const gchar *keyword;



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