summaryrefslogtreecommitdiffstats
path: root/ext/bigdecimal/bigdecimal.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-31 13:18:10 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-31 13:18:10 +0000
commit8720d66427eb299ab21534e7d67f999d60f18119 (patch)
tree23b3a9aeab320cfebb506b04d2f878a11407b907 /ext/bigdecimal/bigdecimal.c
parent4502e9b6b5333edbb887b0b7dd480fdd6147fbbc (diff)
downloadruby-8720d66427eb299ab21534e7d67f999d60f18119.tar.gz
ruby-8720d66427eb299ab21534e7d67f999d60f18119.tar.xz
ruby-8720d66427eb299ab21534e7d67f999d60f18119.zip
* ext/bigdecimal/bigdecimal.c (VpMult): prevent memory leak.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal/bigdecimal.c')
-rw-r--r--ext/bigdecimal/bigdecimal.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 51bd6447f..2498ea445 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -3164,7 +3164,10 @@ VpMult(Real *c, Real *a, Real *b)
/* set LHSV c info */
c->exponent = a->exponent; /* set exponent */
- if(!AddExponent(c,b->exponent)) return 0;
+ if(!AddExponent(c,b->exponent)) {
+ VpFree(c);
+ return 0;
+ }
VpSetSign(c,VpGetSign(a)*VpGetSign(b)); /* set sign */
Carry = 0;
nc = ind_c = MxIndAB;