aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src/legacy/erl_marshal.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2010-11-22 12:19:21 +0100
committerBjörn-Egil Dahlberg <[email protected]>2010-11-22 12:19:26 +0100
commit29b572dbd1546796a0a94066548edfa3da6b4b9d (patch)
tree5adabfdfdf1ff12ef82ffa0322b225d4b8330225 /lib/erl_interface/src/legacy/erl_marshal.c
parentf7d51b976aceb0c3e2c48ad1be2df8b6fff6353d (diff)
parent9dae2c94560e0b8e5a69f8d2b22f4abc858c3bd7 (diff)
downloadotp-29b572dbd1546796a0a94066548edfa3da6b4b9d.tar.gz
otp-29b572dbd1546796a0a94066548edfa3da6b4b9d.tar.bz2
otp-29b572dbd1546796a0a94066548edfa3da6b4b9d.zip
Merge branch 'ms/ei-fixes' into dev
* ms/ei-fixes: ei: check memory was allocated ei: error if return value of ei_alloc_big is NULL OTP-8943
Diffstat (limited to 'lib/erl_interface/src/legacy/erl_marshal.c')
-rw-r--r--lib/erl_interface/src/legacy/erl_marshal.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/erl_interface/src/legacy/erl_marshal.c b/lib/erl_interface/src/legacy/erl_marshal.c
index 18315bfbd3..5084c65230 100644
--- a/lib/erl_interface/src/legacy/erl_marshal.c
+++ b/lib/erl_interface/src/legacy/erl_marshal.c
@@ -1890,8 +1890,11 @@ static int cmp_big_big(unsigned char**e1, unsigned char **e2)
ei_get_type((char *)*e1,&i1,&t1,&n1);
ei_get_type((char *)*e2,&i2,&t2,&n2);
- b1 = ei_alloc_big(n1);
- b2 = ei_alloc_big(n2);
+ if ( (b1 = ei_alloc_big(n1)) == NULL) return -1;
+ if ( (b2 = ei_alloc_big(n2)) == NULL) {
+ ei_free_big(b1);
+ return 1;
+ }
ei_decode_big((char *)*e1,&i1,b1);
ei_decode_big((char *)*e2,&i2,b2);