]> git.sesse.net Git - mlt/commitdiff
Cleanup & fix memleak
authorj-b-m <jb@kdenlive.org>
Thu, 29 Jul 2010 20:01:09 +0000 (21:01 +0100)
committerj-b-m <jb@kdenlive.org>
Thu, 29 Jul 2010 20:01:09 +0000 (21:01 +0100)
modified:   gtk2/producer_pixbuf.c
modified:   qimage/qimage_wrapper.cpp

src/modules/gtk2/producer_pixbuf.c
src/modules/qimage/qimage_wrapper.cpp

index f7ab325855b946be2cf71906c8b60e193d94037f..25edda749e4e49678b7f8c9d863bb260aa863e38 100644 (file)
@@ -293,13 +293,17 @@ static void refresh_image( producer_pixbuf this, mlt_frame frame, int width, int
                        if ( disable_exif == 0) {
                                ExifData *d = exif_data_new_from_file( mlt_properties_get_value( this->filenames, image_idx ) );
                                ExifEntry *entry;
-                               ExifByteOrder byte_order = exif_data_get_byte_order (d);
                                int exif_orientation = 0;
+
                                /* get orientation and rotate image accordingly if necessary */
-                               if ((entry = exif_content_get_entry (d->ifd[EXIF_IFD_0], EXIF_TAG_ORIENTATION)))
-                               {
-                                       exif_orientation = exif_get_short (entry->data, byte_order);
+                               if (d) {
+                                       if ( ( entry = exif_content_get_entry ( d->ifd[EXIF_IFD_0], EXIF_TAG_ORIENTATION ) ) )
+                                               exif_orientation = exif_get_short (entry->data, exif_data_get_byte_order (d));
+
+                                       /* Free the EXIF data */
+                                       exif_data_unref(d);
                                }
+
                                if ( exif_orientation > 1 )
                                {
                                        GdkPixbuf *processed;
index 4af012a810ecb922f73a967d0d314120090fe03c..a454fd0fdb9690583522cba9d2e6136dfd004321 100644 (file)
@@ -176,13 +176,16 @@ void refresh_qimage( producer_qimage self, mlt_frame frame, int width, int heigh
                        if ( disable_exif == 0) {
                                ExifData *d = exif_data_new_from_file( mlt_properties_get_value( self->filenames, image_idx ) );
                                ExifEntry *entry;
-                               ExifByteOrder byte_order = exif_data_get_byte_order (d);
                                int exif_orientation = 0;
                                /* get orientation and rotate image accordingly if necessary */
-                               if ((entry = exif_content_get_entry (d->ifd[EXIF_IFD_0], EXIF_TAG_ORIENTATION)))
-                               {
-                                       exif_orientation = exif_get_short (entry->data, byte_order);
+                               if (d) {
+                                       if ( ( entry = exif_content_get_entry ( d->ifd[EXIF_IFD_0], EXIF_TAG_ORIENTATION ) ) )
+                                               exif_orientation = exif_get_short (entry->data, exif_data_get_byte_order (d));
+                                       
+                                       /* Free the EXIF data */
+                                       exif_data_unref(d);
                                }
+
                                if ( exif_orientation > 1 )
                                {
                                      // Rotate image according to exif data