History

bignum: allocate cvalue after init to avoid garbage leak on wrong arg type

Sigrid Solveig Haflínudóttir committed 4 months ago

Commit 40a17b01 parent 15582af1 file · +3 −1Browse files

Unified · Split

src/cvalues.c+3−1
@@ -415,8 +415,10 @@ BUILTIN("bignum", bignum) · 414 unmodified lines
415 args = sl.sp-1;415 args = sl.sp-1;
416 }else416 }else
417 argcount(1);417 argcount(1);
418 mpint *m;
419 cvalue_bignum_init(sl_bignumtype, args[0], &m);
418 sl_v cv = cvalue(sl_bignumtype, sizeof(mpint*));420 sl_v cv = cvalue(sl_bignumtype, sizeof(mpint*));
419 cvalue_bignum_init(sl_bignumtype, args[0], cvalue_data(cv));421 *((mpint**)cvalue_data(cv)) = m;
420 return cv;422 return cv;
421}423}
422 424

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t