Author: pschweitzer
Date: Sun Apr 6 12:35:54 2014
New Revision: 62647
URL:
http://svn.reactos.org/svn/reactos?rev=62647&view=rev
Log:
[EVENTLOG]
- Fix memory leak
- Fix null pointer dereference
CID #515253
CID #716316
Modified:
trunk/reactos/base/services/eventlog/file.c
trunk/reactos/base/services/eventlog/rpc.c
Modified: trunk/reactos/base/services/eventlog/file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/fil…
==============================================================================
--- trunk/reactos/base/services/eventlog/file.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/eventlog/file.c [iso-8859-1] Sun Apr 6 12:35:54 2014
@@ -979,6 +979,7 @@
if (RecBuf->Reserved != LOGFILE_SIGNATURE)
{
DPRINT1("LogFile corrupt!\n");
+ HeapFree(GetProcessHeap(), 0, RecBuf);
RtlReleaseResource(&LogFile->Lock);
return FALSE;
}
Modified: trunk/reactos/base/services/eventlog/rpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/rpc…
==============================================================================
--- trunk/reactos/base/services/eventlog/rpc.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/eventlog/rpc.c [iso-8859-1] Sun Apr 6 12:35:54 2014
@@ -921,20 +921,22 @@
}
Done:
- for (i = 0; i < NumStrings; i++)
- {
- if (StringsArrayW[i] != NULL)
+ if (StringsArrayW != NULL)
+ {
+ for (i = 0; i < NumStrings; i++)
{
- if (StringsArrayW[i]->Buffer)
+ if (StringsArrayW[i] != NULL)
{
- RtlFreeUnicodeString(StringsArrayW[i]);
- HeapFree(MyHeap, 0, StringsArrayW[i]);
+ if (StringsArrayW[i]->Buffer)
+ {
+ RtlFreeUnicodeString(StringsArrayW[i]);
+ HeapFree(MyHeap, 0, StringsArrayW[i]);
+ }
}
}
- }
-
- if (StringsArrayW != NULL)
+
HeapFree(MyHeap, 0, StringsArrayW);
+ }
RtlFreeUnicodeString(&ComputerNameW);