memory leaks
This commit is contained in:
15
os/streams.c
15
os/streams.c
@@ -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) {
|
||||
|
Reference in New Issue
Block a user