2002-07-25 Lutz Müller <lutz@users.sourceforge.net>
authorLutz Mueller <lutz.s.mueller@gmail.com>
Thu, 25 Jul 2002 08:13:29 +0000 (10:13 +0200)
committerLutz Mueller <lutz.s.mueller@gmail.com>
Thu, 25 Jul 2002 08:13:29 +0000 (10:13 +0200)
Patch by Takuro Ashie <makeinu@users.sourceforge.net>:

* libexif/exif-data.c: Plug memory leak.

ChangeLog
libexif/exif-data.c

index a44b124..63622b7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-07-25  Lutz Müller <lutz@users.sourceforge.net>
+
+       Patch by Takuro Ashie <makeinu@users.sourceforge.net>:
+
+       * libexif/exif-data.c: Plug memory leak.
+
 2002-07-10  Lutz Müller <lutz@users.sourceforge.net>
 
        Bug spotted by Andres <aplaza@smalcamera.com>:
index 3da02cb..bae10bd 100644 (file)
@@ -658,13 +658,37 @@ exif_data_unref (ExifData *data)
 void
 exif_data_free (ExifData *data)
 {
-       if (data->ifd0)
+       if (!data)
+               return;
+
+       if (data->ifd0) {
                exif_content_unref (data->ifd0);
-       if (data->ifd1)
+               data->ifd0 = NULL;
+       }
+       if (data->ifd1) {
                exif_content_unref (data->ifd1);
-       if (data->data)
+               data->ifd1 = NULL;
+       }
+       if (data->ifd_exif) {
+               exif_content_unref (data->ifd_exif);
+               data->ifd_exif = NULL;
+       }
+       if (data->ifd_gps) {
+               exif_content_unref (data->ifd_gps);
+               data->ifd_gps = NULL;
+       }
+       if (data->ifd_interoperability) {
+               exif_content_unref (data->ifd_interoperability);
+               data->ifd_interoperability = NULL;
+       }
+       if (data->data) {
                free (data->data);
-       free (data->priv);
+               data->data = NULL;
+       }
+       if (data->priv) {
+               free (data->priv);
+               data->priv = NULL;
+       }
        free (data);
 }