[easytag/easytag-2-2] Fix double unref when opening an invalid Ogg file



commit 3a43e93dc44ab759e72f20fb09993dbfe7c93c57
Author: David King <amigadave amigadave com>
Date:   Fri Nov 7 08:26:19 2014 +0000

    Fix double unref when opening an invalid Ogg file

 src/vcedit.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/vcedit.c b/src/vcedit.c
index a1e212d..37ce26a 100644
--- a/src/vcedit.c
+++ b/src/vcedit.c
@@ -73,7 +73,11 @@ static void vcedit_clear_internals(vcedit_state *state)
     }
 #endif /* ENABLE_OPUS */
 
-    g_object_unref (state->in);
+    if (state->in)
+    {
+        g_object_unref (state->in);
+    }
+
     memset(state, 0, sizeof(*state));
 }
 
@@ -291,14 +295,14 @@ vcedit_open(vcedit_state *state, GFile *file, GError **error)
     g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
     istream = g_file_read (file, NULL, error);
+    state->in = istream;
+
     if (!istream)
     {
         g_assert (error == NULL || *error != NULL);
         return FALSE;
     }
 
-    state->in = istream;
-
     state->oy = malloc(sizeof(ogg_sync_state));
     ogg_sync_init(state->oy);
 


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