[easytag] Verify the path in Browser_Update_Current_Path



commit 26eb6308fd0e8681728b72f9559598e59847a359
Author: David King <amigadave amigadave com>
Date:   Mon Feb 11 19:05:49 2013 +0000

    Verify the path in Browser_Update_Current_Path
    
    The comment at the top of Browser_Update_Current_Path mentioned that the
    invariant check for BrowserCurrentPath != path was to avoid a memory
    problem, but the check was only executed when path was NULL.
    
    Fixes bug 693613.

 src/browser.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/browser.c b/src/browser.c
index e988545..cac96fa 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -311,9 +311,11 @@ Browser_Tree_Get_Path_Of_Selected_Node (void)
 static void
 Browser_Update_Current_Path (const gchar *path)
 {
-    /* Be sure that we aren't passing 'BrowserCurrentPath' as parameter of the function :
-     * to avoid some memory problems */
-    g_return_if_fail (path != NULL || path != BrowserCurrentPath);
+    g_return_if_fail (path != NULL);
+
+    /* Be sure that we aren't passing 'BrowserCurrentPath' as parameter of the
+     * function to avoid an invalid read. */
+    if (path != BrowserCurrentPath) return;
 
     if (BrowserCurrentPath != NULL)
         g_free(BrowserCurrentPath);


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