瀏覽代碼

[settings] Fix broken assertion in fetch_string_setting_copy()

Reported-by: Stefan Hajnoczi <stefanha@gmail.com>
tags/v0.9.8
Michael Brown 15 年之前
父節點
當前提交
5bd32315d0
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3
    2
      src/core/settings.c

+ 3
- 2
src/core/settings.c 查看文件

@@ -448,7 +448,7 @@ int fetch_string_setting_copy ( struct settings *settings,
448 448
 				struct setting *setting,
449 449
 				char **data ) {
450 450
 	int len;
451
-	int check_len;
451
+	int check_len = 0;
452 452
 
453 453
 	len = fetch_setting_len ( settings, setting );
454 454
 	if ( len < 0 )
@@ -458,7 +458,8 @@ int fetch_string_setting_copy ( struct settings *settings,
458 458
 	if ( ! *data )
459 459
 		return -ENOMEM;
460 460
 
461
-	fetch_string_setting ( settings, setting, *data, ( len + 1 ) );
461
+	check_len = fetch_string_setting ( settings, setting, *data,
462
+					   ( len + 1 ) );
462 463
 	assert ( check_len == len );
463 464
 	return len;
464 465
 }

Loading…
取消
儲存