[easytag] Avoid a crash when handling invalid arguments



commit c01a3ee46ca0b8e35fafa5008d5b6ef5e8e66592
Author: David King <amigadave amigadave com>
Date:   Thu Feb 6 22:32:11 2014 +0000

    Avoid a crash when handling invalid arguments
    
    Do not try to dereference a NULL ETCore pointer.

 src/et_core.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/et_core.c b/src/et_core.c
index 3ba6191..e34de86 100644
--- a/src/et_core.c
+++ b/src/et_core.c
@@ -269,14 +269,15 @@ void ET_Core_Free (void)
     ET_Core_Initialize();
 }
 
-void ET_Core_Destroy (void)
+void
+ET_Core_Destroy (void)
 {
-    // Free attached data
-    ET_Core_Free();
-
-    // Unallocate
-    g_free(ETCore);
-    ETCore = NULL;
+    if (ETCore)
+    {
+        ET_Core_Free ();
+        g_free (ETCore);
+        ETCore = NULL;
+    }
 }
 
 


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