diff --git a/reactos/lib/setupapi/install.c b/reactos/lib/setupapi/install.c index c1f92458e8f..933ff976b13 100644 --- a/reactos/lib/setupapi/install.c +++ b/reactos/lib/setupapi/install.c @@ -433,10 +433,10 @@ static BOOL registry_callback( HINF hinf, PCWSTR field, void *arg ) /* and now do it */ if (!do_reg_operation( hkey, buffer, &context, flags )) { - RegCloseKey( hkey ); + if (hkey != root_key) RegCloseKey( hkey ); return FALSE; } - RegCloseKey( hkey ); + if (hkey != root_key) RegCloseKey( hkey ); } return TRUE; }