Skip to content

Commit

Permalink
Fix leak of tmp values in long.__truediv__
Browse files Browse the repository at this point in the history
  • Loading branch information
klange committed Feb 27, 2024
1 parent 53c08ad commit 9ad8501
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/obj_long.c
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,9 @@ KRK_Method(long,__truediv__) {
else if (IS_INTEGER(argv[1])) krk_long_init_si(tmp, AS_INTEGER(argv[1]));
else if (IS_FLOATING(argv[1])) return checked_float_div(krk_long_get_double(self->value), AS_FLOATING(argv[1]));
else return NOTIMPL_VAL();
return _krk_long_truediv(self->value,tmp);
KrkValue result = _krk_long_truediv(self->value,tmp);
krk_long_clear(tmp);
return result;
}

KRK_Method(long,__rtruediv__) {
Expand All @@ -1445,7 +1447,9 @@ KRK_Method(long,__rtruediv__) {
else if (IS_INTEGER(argv[1])) krk_long_init_si(tmp, AS_INTEGER(argv[1]));
else if (IS_FLOATING(argv[1])) return checked_float_div(AS_FLOATING(argv[1]), krk_long_get_double(self->value));
else return NOTIMPL_VAL();
return _krk_long_truediv(tmp,self->value);
KrkValue result = _krk_long_truediv(tmp,self->value);
krk_long_clear(tmp);
return result;
}
#endif

Expand Down

0 comments on commit 9ad8501

Please sign in to comment.