aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ic
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-07-11 19:54:17 +0200
committerSverker Eriksson <[email protected]>2018-07-11 20:41:40 +0200
commitdcb4042890ea121e29c56eea1dd6c6bcd912e2ba (patch)
tree23c01796ef5ebdd5a7d8066e18699054b80334cd /lib/ic
parentcdfc10af65b613a5315add29a3b7a89c6b513883 (diff)
downloadotp-dcb4042890ea121e29c56eea1dd6c6bcd912e2ba.tar.gz
otp-dcb4042890ea121e29c56eea1dd6c6bcd912e2ba.tar.bz2
otp-dcb4042890ea121e29c56eea1dd6c6bcd912e2ba.zip
ic: Fix memory leak in oe_ei_decode_wstring
Diffstat (limited to 'lib/ic')
-rw-r--r--lib/ic/c_src/oe_ei_decode_wstring.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/ic/c_src/oe_ei_decode_wstring.c b/lib/ic/c_src/oe_ei_decode_wstring.c
index 66eaf66392..d2a8270291 100644
--- a/lib/ic/c_src/oe_ei_decode_wstring.c
+++ b/lib/ic/c_src/oe_ei_decode_wstring.c
@@ -78,8 +78,10 @@ int oe_ei_decode_wstring(const char *buf, int *index, CORBA_wchar *p) {
/* Allocate temporary string */
tmp_space = (char*) malloc((length + 1)*sizeof(char));
- if ((error_code = ei_decode_string(buf, index, tmp_space)) < 0)
- return error_code;
+ if ((error_code = ei_decode_string(buf, index, tmp_space)) < 0) {
+ free(tmp_space);
+ return error_code;
+ }
/* Assign characters to wide characters */
for(tmp = 0; tmp < length; tmp++)
@@ -88,7 +90,7 @@ int oe_ei_decode_wstring(const char *buf, int *index, CORBA_wchar *p) {
p[tmp] = 0; /* Wide NULL */
/* Free temporary string */
- CORBA_free(tmp_space);
+ free(tmp_space);
} else { /* Allocation counting part */