From 35c55c948388a859bbc21567076f37c02a92d87d Mon Sep 17 00:00:00 2001 From: ccremers Date: Thu, 19 Aug 2004 13:55:16 +0000 Subject: [PATCH] - Fixed a bug for NULL case in interm/subterm. - Fixed a bug where the mgu termlist was never deleted in interm/subterm. --- src/mgu.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/mgu.c b/src/mgu.c index c88a398..0c328f3 100644 --- a/src/mgu.c +++ b/src/mgu.c @@ -117,6 +117,8 @@ termlistSubstReset (Termlist tl) //! Most general unifier. /** * Try to determine the most general unifier of two terms. + * Resulting termlist must be termlistDelete'd. + * *@return Returns a list of variables, that were previously open, but are now closed * in such a way that the two terms unify. Returns \ref MGUFAIL if it is impossible. */ @@ -258,6 +260,15 @@ termMguInTerm (Term t1, Term t2, int (*iterator) ()) flag = flag && iterator (tl); // Reset variables termlistSubstReset (tl); + // Remove list + termlistDelete (tl); + } + } + else + { + if (deVar (t1) != NULL) + { + flag = 0; } } return flag; @@ -319,6 +330,15 @@ termMguSubTerm (Term t1, Term t2, int (*iterator) (), flag = flag && iterator (tl, keylist); // Reset variables termlistSubstReset (tl); + // Remove list + termlistDelete (tl); + } + } + else + { + if (deVar (t1) != NULL) + { + flag = 0; } } return flag;