Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/user32/sysparams.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index b407b51811..d9c7779edb 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -3778,10 +3778,9 @@ static BOOL update_monitor_cache(void)
if (device_count && monitor_count < device_count) { - monitor_array = heap_alloc( device_count * sizeof(*monitor_array) ); + monitor_array = heap_realloc( monitors, device_count * sizeof(*monitor_array) ); if (!monitor_array) goto fail; - heap_free( monitors ); monitors = monitor_array; }
@@ -3827,6 +3826,8 @@ fail: SetupDiDestroyDeviceInfoList( devinfo ); LeaveCriticalSection( &monitors_section ); release_display_device_init_mutex( mutex ); + if (!ret) + ERR("Failed to update monitor cache.\n"); return ret; }