memory leaks

This commit is contained in:
Vitor Santos Costa
2016-05-30 11:25:28 +01:00
parent 4ac6d11dca
commit 71c49f5063
5 changed files with 75 additions and 52 deletions

View File

@@ -248,11 +248,11 @@ has_reposition(int sno,
}
char *Yap_guessFileName(FILE* file, int sno, char *nameb, size_t max) {
if (!nameb) {
nameb = malloc(max(256, max));
}
if (!file) {
strcpy(nameb, "memory buffer");
if (!nameb) {
nameb = malloc(max(256, max));
}
if (!file) {
strcpy(nameb, "memory buffer");
return nameb;
}
int f = fileno(file);
@@ -639,7 +639,8 @@ static Int cont_stream_property(USES_REGS1) { /* current_stream */
if (IsAtomTerm(args[STREAM_PROPERTY_ALIAS].tvalue)) {
// one solution only
i = Yap_CheckAlias(AtomOfTerm(args[STREAM_PROPERTY_ALIAS].tvalue));
UNLOCK(GLOBAL_Stream[i].streamlock);
free(args)
UNLOCK(GLOBAL_Stream[i].streamlock);
if (i < 0 || !Yap_unify(ARG1, Yap_MkStream(i))) {
cut_fail();
}
@@ -648,7 +649,7 @@ static Int cont_stream_property(USES_REGS1) { /* current_stream */
LOCK(GLOBAL_Stream[i].streamlock);
rc = do_stream_property(i, args PASS_REGS);
UNLOCK(GLOBAL_Stream[i].streamlock);
if (IsVarTerm(t1)) {
if (IsVarTerm(t1)) {
if (rc)
rc = Yap_unify(ARG1, Yap_MkStream(i));
if (p == STREAM_PROPERTY_END) {