[easytag/wip/application-window: 24/25] Remove bogus conditional check in settings parser



commit c3c9fbb4dcb5c7f861e9dec711e81968fc66c7cd
Author: David King <amigadave amigadave com>
Date:   Mon Feb 3 16:31:46 2014 +0000

    Remove bogus conditional check in settings parser
    
    Found with Coverity (CID 1163352).

 src/setting.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/src/setting.c b/src/setting.c
index 534e9be..bf5c7e8 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -1009,17 +1009,13 @@ Set_Config (gchar *line)
 
                 case CV_TYPE_STRING:
                 {
-                    if (!var_value)
-                    {
-                        *(char **)Config_Variables[i].pointer = NULL;
-                        //g_print("\nConfig File Warning: Field of '%s' has no value!\n",var_descriptor);
-                    } else
+
+                    if (*(char **)Config_Variables[i].pointer != NULL)
                     {
-                        if ( *(char **)Config_Variables[i].pointer != NULL )
-                            g_free(*(char **)Config_Variables[i].pointer);
-                        *(char **)Config_Variables[i].pointer = g_malloc(strlen(var_value)+1);
-                        strcpy( *(char **)Config_Variables[i].pointer,var_value );
+                        g_free (*(char **)Config_Variables[i].pointer);
                     }
+
+                    *(char **)Config_Variables[i].pointer = g_strdup (var_value);
                     break;
                 }
 


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