[gimp-gap] fixed broken initialisation of default values in _vin.gap files #589897



commit 284b312c0b28ee8365ca2a39c3d88e09b976486a
Author: Wolfgang Hofer <wolfgangh svn gnome org>
Date:   Tue Jul 28 20:09:18 2009 +0200

    fixed broken initialisation of default values in _vin.gap files #589897

 ChangeLog     |   11 +++++++++++
 gap/gap_vin.c |   51 +++++++++++++++++++++++++--------------------------
 2 files changed, 36 insertions(+), 26 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fdb6104..14d3857 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-07-28 Wolfgang Hofer <hof gimp org>
+
+- fixed broken initialisation of default values in case the file
+  with animation properties (*_vin.gap) does not yet exist.
+  This also fixes the reported resource bug #589897
+  (that allocated memory for GapVinVideoInfo structure
+   that was never freed)
+
+
+  * gap/gap_vin.c
+  
 2009-06-20 Wolfgang Hofer <hof gimp org>
 
 - fixes for many compiler warnings
diff --git a/gap/gap_vin.c b/gap/gap_vin.c
index 2a0de71..93f6bbd 100644
--- a/gap/gap_vin.c
+++ b/gap/gap_vin.c
@@ -151,38 +151,37 @@ static void
 gap_vin_get_all_keylist(GapValKeyList *keylist, GapVinVideoInfo *vin_ptr, char *basename)
 {
   char  *l_vin_filename;
-  GapValTextFileLines *txf_ptr_root;
-  GapVinVideoInfo *l_vin_ptr;
-  
-  l_vin_ptr = g_malloc(sizeof(GapVinVideoInfo));
-  /* init wit defaults (for the case where no video_info file available) */
-  l_vin_ptr->timezoom = 1;
-  l_vin_ptr->framerate = 24.0;
-  l_vin_ptr->active_layer_tracking = GAP_ACTIVE_LAYER_TRACKING_OFF;
+
+  if (vin_ptr != NULL)
+  {
+    /* init wit defaults (for the case where no video_info file available) */
+    vin_ptr->timezoom = 1;
+    vin_ptr->framerate = 24.0;
+    vin_ptr->active_layer_tracking = GAP_ACTIVE_LAYER_TRACKING_OFF;
   
-  l_vin_ptr->onionskin_auto_enable = TRUE;
-  l_vin_ptr->auto_replace_after_load = FALSE;
-  l_vin_ptr->auto_delete_before_save = FALSE;
-
-  l_vin_ptr->num_olayers        = 2;
-  l_vin_ptr->ref_delta          = -1;
-  l_vin_ptr->ref_cycle          = FALSE;
-  l_vin_ptr->stack_pos          = 1;
-  l_vin_ptr->stack_top          = FALSE;
-  l_vin_ptr->asc_opacity        = FALSE;
-  l_vin_ptr->opacity            = 80.0;
-  l_vin_ptr->opacity_delta      = 80.0;
-  l_vin_ptr->ignore_botlayers   = 1;
-  l_vin_ptr->select_mode        = 6;     /* GAP_MTCH_ALL_VISIBLE */
-  l_vin_ptr->select_case        = 0;     /* 0 .. ignore case, 1..case sensitve */
-  l_vin_ptr->select_invert      = 0;     /* 0 .. no invert, 1 ..invert */
-  l_vin_ptr->select_string[0] = '\0';
+    vin_ptr->onionskin_auto_enable = TRUE;
+    vin_ptr->auto_replace_after_load = FALSE;
+    vin_ptr->auto_delete_before_save = FALSE;
+
+    vin_ptr->num_olayers        = 2;
+    vin_ptr->ref_delta          = -1;
+    vin_ptr->ref_cycle          = FALSE;
+    vin_ptr->stack_pos          = 1;
+    vin_ptr->stack_top          = FALSE;
+    vin_ptr->asc_opacity        = FALSE;
+    vin_ptr->opacity            = 80.0;
+    vin_ptr->opacity_delta      = 80.0;
+    vin_ptr->ignore_botlayers   = 1;
+    vin_ptr->select_mode        = 6;     /* GAP_MTCH_ALL_VISIBLE */
+    vin_ptr->select_case        = 0;     /* 0 .. ignore case, 1..case sensitve */
+    vin_ptr->select_invert      = 0;     /* 0 .. no invert, 1 ..invert */
+    vin_ptr->select_string[0] = '\0';
+  }
   
   l_vin_filename = gap_vin_alloc_name(basename);
   if(l_vin_filename)
   {
       gap_val_scann_filevalues(keylist, l_vin_filename);
-      txf_ptr_root = gap_val_load_textfile(l_vin_filename);
       g_free(l_vin_filename);
   }
 }  /* end gap_vin_get_all_keylist */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]