[settings] Fix broken assertion in fetch_string_setting_copy()
authorMichael Brown <mcb30@etherboot.org>
Thu, 26 Mar 2009 09:50:52 +0000 (09:50 +0000)
committerMichael Brown <mcb30@etherboot.org>
Thu, 26 Mar 2009 09:50:52 +0000 (09:50 +0000)
Reported-by: Stefan Hajnoczi <stefanha@gmail.com>
src/core/settings.c

index 55f9638..b00c0d0 100644 (file)
@@ -448,7 +448,7 @@ int fetch_string_setting_copy ( struct settings *settings,
                                struct setting *setting,
                                char **data ) {
        int len;
-       int check_len;
+       int check_len = 0;
 
        len = fetch_setting_len ( settings, setting );
        if ( len < 0 )
@@ -458,7 +458,8 @@ int fetch_string_setting_copy ( struct settings *settings,
        if ( ! *data )
                return -ENOMEM;
 
-       fetch_string_setting ( settings, setting, *data, ( len + 1 ) );
+       check_len = fetch_string_setting ( settings, setting, *data,
+                                          ( len + 1 ) );
        assert ( check_len == len );
        return len;
 }