Index: gdk-pixbuf/gdk-pixbuf-animation.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/gdk-pixbuf-animation.c,v
retrieving revision 1.37
diff -u -r1.37 gdk-pixbuf-animation.c
--- gdk-pixbuf/gdk-pixbuf-animation.c	27 Dec 2004 22:50:45 -0000	1.37
+++ gdk-pixbuf/gdk-pixbuf-animation.c	5 Jan 2005 12:27:00 -0000
@@ -139,7 +139,6 @@
 	guchar buffer [128];
 	GdkPixbufModule *image_module;
         gchar *display_name;
-        gboolean locked = FALSE;
 
 	g_return_val_if_fail (filename != NULL, NULL);
         g_return_val_if_fail (error == NULL || *error == NULL, NULL);
@@ -211,19 +210,21 @@
                 
 		if (pixbuf == NULL) {
                         g_free (display_name);
-                        animation = NULL;
-                        goto out_unlock;
+			return NULL;
                 }
 
                 animation = gdk_pixbuf_non_anim_new (pixbuf);
 
                 g_object_unref (pixbuf);
 	} else {
-                locked = _gdk_pixbuf_lock (image_module);
+		gboolean locked = _gdk_pixbuf_lock (image_module);
 
 		fseek (f, 0, SEEK_SET);
 		animation = (* image_module->load_animation) (f, error);
 
+		if (locked)
+			_gdk_pixbuf_unlock (image_module);
+
                 if (animation == NULL && error != NULL && *error == NULL) {
                         /* I don't trust these crufty longjmp()'ing
                          * image libs to maintain proper error
@@ -247,9 +248,6 @@
 
         g_free (display_name);
 
- out_unlock:
-        if (locked)
-                _gdk_pixbuf_unlock (image_module);
 	return animation;
 }
 
