From ec5b3c3ea68c2a6b6f95d105562752ba2d203786 Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Fri, 2 Jun 2006 20:43:44 +0100 Subject: [PATCH] rpcrt4: Freeing a NULL context handle is allowed. --- dlls/rpcrt4/ndr_marshall.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index befe1242246..03f5c6c0b03 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -4504,12 +4504,15 @@ static UINT ndr_update_context_handle(NDR_CCONTEXT *CContext, /* a null UUID means we should free the context handle */ if (IsEqualGUID(&chi->uuid, &GUID_NULL)) { - che = get_context_entry(*CContext); - if (!che) - return ERROR_INVALID_HANDLE; - list_remove(&che->entry); - HeapFree(GetProcessHeap(), 0, che); - che = NULL; + if (*CContext) + { + che = get_context_entry(*CContext); + if (!che) + return ERROR_INVALID_HANDLE; + list_remove(&che->entry); + HeapFree(GetProcessHeap(), 0, che); + che = NULL; + } } /* if there's no existing entry matching the GUID, allocate one */ else if (!(che = context_entry_from_guid(&chi->uuid)))