[Commits] poppler_viewer.c 1.1.2.99 1.1.2.100

mones at claws-mail.org mones at claws-mail.org
Mon Aug 27 14:59:54 CEST 2012


Update of /home/claws-mail/plugins/pdf_viewer/src
In directory srv:/tmp/cvs-serv20614/src

Modified Files:
      Tag: gtk2
	poppler_viewer.c 
Log Message:
2012-08-27 [mones]	0.9.2cvs2

	* src/poppler_viewer.c
		Fix memory leaks, thanks to Colin's eagle eye. 

Index: poppler_viewer.c
===================================================================
RCS file: /home/claws-mail/plugins/pdf_viewer/src/Attic/poppler_viewer.c,v
retrieving revision 1.1.2.99
retrieving revision 1.1.2.100
diff -u -d -r1.1.2.99 -r1.1.2.100
--- poppler_viewer.c	27 Aug 2012 10:49:38 -0000	1.1.2.99
+++ poppler_viewer.c	27 Aug 2012 12:59:52 -0000	1.1.2.100
@@ -1265,10 +1265,11 @@
 		GTK_EVENTS_FLUSH();
 
 		if (pdf_viewer_mimepart_get_type(viewer->to_load) == TYPE_PS) {
-			gchar *cmdline = NULL, *tmp = NULL;
+			gchar *cmdline = NULL, *tmp = NULL, *gspath = NULL;
 			gint result = 0;
 
-			if (g_find_program_in_path("gs") != NULL) {
+			if ((gspath = g_find_program_in_path("gs")) != NULL) {
+				g_free(gspath);
 				/* convert postscript to pdf */
 				tmpfile = get_tmp_file();
 				cmdline = g_strdup_printf(
@@ -2025,6 +2026,7 @@
 
 gint plugin_init(gchar **error)
 {
+	gchar *gspath = NULL;
 #ifdef G_OS_UNIX
 	bindtextdomain(TEXTDOMAIN, LOCALEDIR);
 #else
@@ -2040,7 +2042,7 @@
 	if (!check_plugin_version(MAKE_NUMERIC_VERSION(3,7,10,41),
 		    VERSION_NUMERIC, _("PDF Viewer"), error)) return -1;
 
-	if (g_find_program_in_path("gs") == NULL) {
+	if ((gspath = g_find_program_in_path("gs")) == NULL) {
 		gchar *pmsg = msg;
 		msg = g_strdup_printf(_("Warning: could not find ghostscript binary (gs) required "
 					"for %s plugin to process PostScript attachments, only PDF "
@@ -2049,6 +2051,9 @@
 					), _("PDF Viewer"), pmsg);
 		g_free(pmsg);
 	}
+	else {
+		g_free(gspath);
+	}
 	
 	mimeview_register_viewer_factory(&pdf_viewer_factory);
 	return 0;



More information about the Commits mailing list