From f11525033d2e99e7b05b90c8ce3eee542f822393 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Sat, 7 May 2005 01:17:36 +0000 Subject: [PATCH] Fix driver loading. patch by tinus svn path=/trunk/; revision=15070 --- reactos/ntoskrnl/io/driver.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/io/driver.c b/reactos/ntoskrnl/io/driver.c index a2fee3a0718..7e0bffb2c1f 100644 --- a/reactos/ntoskrnl/io/driver.c +++ b/reactos/ntoskrnl/io/driver.c @@ -916,8 +916,20 @@ IopCreateServiceListEntry(PUNICODE_STRING ServiceName) NULL); if (!NT_SUCCESS(Status) || Service->Start > 1) { - ExFreePool(Service->ServiceGroup.Buffer); - ExFreePool(Service->ImagePath.Buffer); + /* + * If something goes wrong during RtlQueryRegistryValues + * it'll just drop everything on the floor and return, + * so you have to check if the buffers were filled. + * Luckily we zerofilled the Service. + */ + if (Service->ServiceGroup.Buffer) + { + ExFreePool(Service->ServiceGroup.Buffer); + } + if (Service->ImagePath.Buffer) + { + ExFreePool(Service->ImagePath.Buffer); + } ExFreePool(Service); return(Status); }