diff --git a/src/eval.cpp b/src/eval.cpp index 4574192ef..a011f1f4c 100644 --- a/src/eval.cpp +++ b/src/eval.cpp @@ -1103,9 +1103,15 @@ namespace Sass { } union Sass_Value* c_val = c_func(c_args, c_function, compiler()); if (sass_value_get_tag(c_val) == SASS_ERROR) { - error("error in C function " + c->name() + ": " + sass_error_get_message(c_val), c->pstate(), traces); + std::string message("error in C function " + c->name() + ": " + sass_error_get_message(c_val)); + sass_delete_value(c_val); + sass_delete_value(c_args); + error(message, c->pstate(), traces); } else if (sass_value_get_tag(c_val) == SASS_WARNING) { - error("warning in C function " + c->name() + ": " + sass_warning_get_message(c_val), c->pstate(), traces); + std::string message("warning in C function " + c->name() + ": " + sass_warning_get_message(c_val)); + sass_delete_value(c_val); + sass_delete_value(c_args); + error(message, c->pstate(), traces); } result = c2ast(c_val, traces, c->pstate()); diff --git a/src/sass_values.cpp b/src/sass_values.cpp index 34c591a24..4927ee20d 100644 --- a/src/sass_values.cpp +++ b/src/sass_values.cpp @@ -290,7 +290,7 @@ extern "C" { union Sass_Value* ADDCALL sass_value_op (enum Sass_OP op, const union Sass_Value* a, const union Sass_Value* b) { - Sass::Value_Ptr rv; + Sass::Value_Obj rv; try { @@ -341,8 +341,7 @@ extern "C" { if (!rv) return sass_make_error("invalid return value"); // convert result back to ast node - return ast_node_to_sass_value(rv); - + return ast_node_to_sass_value(rv.ptr()); } // simply pass the error message back to the caller for now