Fixes for processing write to buffer: should b more robust, but we still may have memory leaks

This commit is contained in:
Vitor Santos Costa
2016-04-22 18:19:58 +01:00
parent cd41d373db
commit f966a5b912
9 changed files with 1102 additions and 1073 deletions

View File

@@ -1325,7 +1325,7 @@ static Int term_to_string(USES_REGS1) {
const char *s;
if (IsVarTerm(t2)) {
size_t length;
s = Yap_TermToString(ARG1, NULL, 0, &length, NULL,
s = Yap_TermToString(ARG1, &length, LOCAL_encoding,
Quote_illegal_f | Handle_vars_f);
if (!s || !MkStringTerm(s)) {
Yap_Error(RESOURCE_ERROR_HEAP, t1,
@@ -1357,7 +1357,7 @@ static Int term_to_atom(USES_REGS1) {
Atom at;
if (IsVarTerm(t2)) {
size_t length;
char *s = Yap_TermToString(Deref(ARG1), NULL, 0, &length, NULL,
char *s = Yap_TermToString(Deref(ARG1), &length, LOCAL_encoding,
Quote_illegal_f | Handle_vars_f);
if (!s || !(at = Yap_LookupAtom(s))) {
Yap_Error(RESOURCE_ERROR_HEAP, t2,