[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rockbox-cvs
Subject:    Always initialize "item"
From:       gerrit () rockbox ! org
Date:       2014-12-22 20:13:51
Message-ID: 201412222013.sBMKDpPU032169 () giant ! haxx ! se
[Download RAW message or body]

commit 06eeab02422b49680a812e0120806f8628cd9c38
Author: Thomas Jarosch <tomj@simonv.com>
Date:   Mon Dec 22 21:04:10 2014 +0100

    Always initialize "item"
    
    Otherwise item.cfg_name and item.default_val
    will contain garbage. It doesn't seem to have
    an effect right now, but who knows what
    a future refactoring might do.
    
    cppcheck reported:
    [rockbox/apps/settings.c:1268]: (error) Uninitialized variable: item
    
    Change-Id: Ic4d0c302929613de8f291cd2d69cd39db8711107

diff --git a/apps/settings.c b/apps/settings.c
index 515e7cb..4b2c1fe 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -1255,6 +1255,7 @@ bool set_option(const char* string, const void* variable, enum optiontype type,
         function, UNIT_INT, 0, numoptions-1, 1,
         set_option_formatter, set_option_get_talk_id
     };
+    memset(item, 0, sizeof(struct settings_list));
     set_option_options = options;
     item.int_setting = &data;
     item.flags = F_INT_SETTING|F_T_INT;
_______________________________________________
rockbox-cvs mailing list
rockbox-cvs@cool.haxx.se
http://cool.haxx.se/cgi-bin/mailman/listinfo/rockbox-cvs

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic