Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
344e8acb
Commit
344e8acb
authored
Sep 26, 2007
by
Andrew Talbot
Committed by
Alexandre Julliard
Sep 27, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Fix a memory leak.
parent
dfac0635
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
profile.c
dlls/kernel32/profile.c
+12
-12
No files found.
dlls/kernel32/profile.c
View file @
344e8acb
...
...
@@ -311,7 +311,7 @@ static inline ENCODING PROFILE_DetectTextEncoding(const void * buffer, int * len
*/
static
PROFILESECTION
*
PROFILE_Load
(
HANDLE
hFile
,
ENCODING
*
pEncoding
)
{
void
*
pBuffer
;
void
*
buffer_base
,
*
pBuffer
;
WCHAR
*
szFile
;
const
WCHAR
*
szLineStart
,
*
szLineEnd
;
const
WCHAR
*
szValueStart
,
*
szEnd
,
*
next_line
;
...
...
@@ -327,20 +327,20 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
if
(
dwFileSize
==
INVALID_FILE_SIZE
)
return
NULL
;
pBuffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwFileSize
);
if
(
!
pBuffer
)
return
NULL
;
buffer_base
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwFileSize
);
if
(
!
buffer_base
)
return
NULL
;
if
(
!
ReadFile
(
hFile
,
pBuffer
,
dwFileSize
,
&
dwFileSize
,
NULL
))
if
(
!
ReadFile
(
hFile
,
buffer_base
,
dwFileSize
,
&
dwFileSize
,
NULL
))
{
HeapFree
(
GetProcessHeap
(),
0
,
pBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer_base
);
WARN
(
"Error %d reading file
\n
"
,
GetLastError
());
return
NULL
;
}
len
=
dwFileSize
;
*
pEncoding
=
PROFILE_DetectTextEncoding
(
pBuffer
,
&
len
);
*
pEncoding
=
PROFILE_DetectTextEncoding
(
buffer_base
,
&
len
);
/* len is set to the number of bytes in the character marker.
* we want to skip these bytes */
pBuffer
=
(
char
*
)
pBuffer
+
len
;
pBuffer
=
(
char
*
)
buffer_base
+
len
;
dwFileSize
-=
len
;
switch
(
*
pEncoding
)
{
...
...
@@ -351,7 +351,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
szFile
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
!
szFile
)
{
HeapFree
(
GetProcessHeap
(),
0
,
pBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer_base
);
return
NULL
;
}
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
pBuffer
,
dwFileSize
,
szFile
,
len
);
...
...
@@ -364,7 +364,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
szFile
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
!
szFile
)
{
HeapFree
(
GetProcessHeap
(),
0
,
pBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer_base
);
return
NULL
;
}
MultiByteToWideChar
(
CP_UTF8
,
0
,
(
char
*
)
pBuffer
,
dwFileSize
,
szFile
,
len
);
...
...
@@ -383,7 +383,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
break
;
default:
FIXME
(
"encoding type %d not implemented
\n
"
,
*
pEncoding
);
HeapFree
(
GetProcessHeap
(),
0
,
pBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer_base
);
return
NULL
;
}
...
...
@@ -392,7 +392,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
{
if
(
szFile
!=
pBuffer
)
HeapFree
(
GetProcessHeap
(),
0
,
szFile
);
HeapFree
(
GetProcessHeap
(),
0
,
pBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer_base
);
return
NULL
;
}
first_section
->
name
[
0
]
=
0
;
...
...
@@ -489,7 +489,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
}
if
(
szFile
!=
pBuffer
)
HeapFree
(
GetProcessHeap
(),
0
,
szFile
);
HeapFree
(
GetProcessHeap
(),
0
,
pBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer_base
);
return
first_section
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment