Skip to content

Commit a117bae

Browse files
committed
Memory Leak fixed
1 parent 4e26bfd commit a117bae

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

ext/symengine/symengine.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void Init_symengine() {
6464

6565
//RealDouble Class
6666
c_real_double = rb_define_class_under(m_symengine, "RealDouble", c_basic);
67-
rb_define_alloc_func(c_double, cbasic_alloc);
67+
rb_define_alloc_func(c_real_double, cbasic_alloc);
6868

6969
//Rational class
7070
c_rational = rb_define_class_under(m_symengine, "Rational", c_basic);

ext/symengine/symengine_utils.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ void sympify(VALUE operand2, basic_struct *cbasic_operand2) {
1515
GET_SYMINTFROMVAL(operand2, cbasic_operand2);
1616
break;
1717

18-
case T_FLOAT:
19-
Rb_Temp_String = rb_funcall(operand2, rb_intern("to_s"), 0, NULL);
20-
s = StringValueCStr(Rb_Temp_String);
21-
real_double_set_d(this, atof(s));
18+
case T_FLOAT:
19+
Rb_Temp_String = rb_funcall(operand2, rb_intern("to_s"), 0, NULL);
2220

21+
s = StringValueCStr(Rb_Temp_String);
22+
double f = atof(s);
23+
real_double_set_d(cbasic_operand2, f);
2324
break;
2425

2526
case T_RATIONAL:

0 commit comments

Comments
 (0)