Reactos

[RPCRT4] Better handle buffers reallocation failure case (#8461) master

Addendum to commit 7f1075986f (PR #8305). Addresses review comment https://github.com/reactos/reactos/pull/8305#discussion_r2505628716 In `expand_pointer_table_if_necessary()`, if any of the `RefIdToPointer` `XlatTable` or `StateTable` buffers failed to be reallocated, the `realloc()` call would return NULL while the underlying buffer still be valid. Directly assigning the reallocation result to the pointers would then leak the buffers. With this fix, the `realloc()` result is stored in a temporary pointer. If the result is NULL, we free the original buffer, since the intended code behaviour is to reset all the tables. If the result is a valid pointer to the reallocated buffer, then we can use it instead.


+30 -1
2 changed files