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:
831b74d
)
Fixed memory leak.
author
Armin Novak
<armin.novak@gmail.com>
Sun, 16 Nov 2014 16:21:36 +0000
(17:21 +0100)
committer
Armin Novak
<armin.novak@gmail.com>
Sun, 16 Nov 2014 16:21:36 +0000
(17:21 +0100)
winpr/libwinpr/environment/environment.c
patch
|
blob
|
history
diff --git
a/winpr/libwinpr/environment/environment.c
b/winpr/libwinpr/environment/environment.c
index
917e623
..
fd4a0bb
100644
(file)
--- a/
winpr/libwinpr/environment/environment.c
+++ b/
winpr/libwinpr/environment/environment.c
@@
-355,11
+355,17
@@
LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
while ((offset + length + 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;
}
p = &(lpszEnvironmentBlock[offset]);