projects
/
platform
/
upstream
/
freerdp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cf5b9a7
)
Fixed use after free.
author
Armin Novak
<armin.novak@gmail.com>
Sun, 16 Nov 2014 14:13:08 +0000
(15:13 +0100)
committer
Armin Novak
<armin.novak@gmail.com>
Sun, 16 Nov 2014 14:13:08 +0000
(15:13 +0100)
winpr/libwinpr/environment/environment.c
patch
|
blob
|
history
diff --git
a/winpr/libwinpr/environment/environment.c
b/winpr/libwinpr/environment/environment.c
index
70768be
..
0fd4e86
100644
(file)
--- a/
winpr/libwinpr/environment/environment.c
+++ b/
winpr/libwinpr/environment/environment.c
@@
-390,11
+390,17
@@
LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
{
while ((offset + mergeLength + 8) > cchEnvironmentBlock)
{
+ LPCH tmp;
cchEnvironmentBlock *= 2;
-
lpszEnvironmentBlock
= (LPCH) realloc(lpszEnvironmentBlock, cchEnvironmentBlock * sizeof(CHAR));
+
tmp
= (LPCH) realloc(lpszEnvironmentBlock, cchEnvironmentBlock * sizeof(CHAR));
- if (!lpszEnvironmentBlock)
+ if (!tmp)
+ {
+ if (lpszEnvironmentBlock)
+ free(lpszEnvironmentBlock);
return NULL;
+ }
+ lpszEnvironmentBlock = tmp;
}
foundMerge = 1;