> This doesn't look right to me. Why wouldn't you only free thumbname when
> pixbuf is non-NULL?
>
> It seems to me, that the right fix, would be to move g_free(thumbname)
> out of the g_file_text()-if?

No, the problem is that the name is being passed to gdk_pixbuf_save
after being freed. My previous patch would replace the invalid memory
access with a memory leak.

I have attached one that should fix the problem without adding a leak.
It is ugly. It might be possible to split the function or add a "goto
cleanup"....

Cheers,
Rafael
Index: src/tiff-meta.c
===================================================================
--- src/tiff-meta.c	(revision 1864)
+++ src/tiff-meta.c	(working copy)
@@ -621,13 +621,20 @@
 		if (g_file_test(thumbname, G_FILE_TEST_EXISTS))
 		{
 			pixbuf = gdk_pixbuf_new_from_file(thumbname, NULL);
-			g_free(thumbname);
-			if (pixbuf) return(pixbuf);
+			if (pixbuf)
+			{
+				g_free(thumbname);
+				return(pixbuf);
+			}
 		}
 	}
 
 	if (!(rawfile = raw_open_file(src)))
+	{
+		if (thumbname)
+			g_free(thumbname);
 		return(NULL);
+	}
 	raw_init_file_tiff(rawfile, 0);
 
 	meta = rs_metadata_new();
@@ -725,6 +732,7 @@
 
 	rs_metadata_free(meta);
 	raw_close_file(rawfile);
+	g_free(thumbname);
 
 	return(pixbuf);
 }
_______________________________________________
Rawstudio-dev mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-dev

Reply via email to