* src/bddop.c (bdd_support): Free supportSet if it needs to be

reallocated.  This fixes a memory leak reported by
Souheib.Baarir@lip6.fr.
This commit is contained in:
Alexandre Duret-Lutz 2004-01-07 16:05:21 +00:00
parent 9297d6dd9f
commit 7aecf4ad09
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2004-01-07 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/bddop.c (bdd_support): Free supportSet if it needs to be
reallocated. This fixes a memory leak reported by
Souheib.Baarir@lip6.fr.
2003-11-14 Alexandre Duret-Lutz <adl@src.lip6.fr> 2003-11-14 Alexandre Duret-Lutz <adl@src.lip6.fr>
* examples/Makefile.def (AM_CPPFLAGS): Add -I$(srcdir). * examples/Makefile.def (AM_CPPFLAGS): Add -I$(srcdir).

View file

@ -1,5 +1,5 @@
/*======================================================================== /*========================================================================
Copyright (C) 1996-2003 by Jorn Lind-Nielsen Copyright (C) 1996-2004 by Jorn Lind-Nielsen
All rights reserved All rights reserved
Permission is hereby granted, without written agreement and without Permission is hereby granted, without written agreement and without
@ -28,7 +28,7 @@
========================================================================*/ ========================================================================*/
/************************************************************************* /*************************************************************************
$Header: /Volumes/CVS/repository/spot/spot/buddy/src/bddop.c,v 1.8 2003/08/06 14:14:16 aduret Exp $ $Header: /Volumes/CVS/repository/spot/spot/buddy/src/bddop.c,v 1.9 2004/01/07 16:05:21 adl Exp $
FILE: bddop.c FILE: bddop.c
DESCR: BDD operators DESCR: BDD operators
AUTH: Jorn Lind AUTH: Jorn Lind
@ -2042,6 +2042,8 @@ BDD bdd_support(BDD r)
/* On-demand allocation of support set */ /* On-demand allocation of support set */
if (supportSize < bddvarnum) if (supportSize < bddvarnum)
{ {
if (supportSet)
free(supportSet);
if ((supportSet=(int*)malloc(bddvarnum*sizeof(int))) == NULL) if ((supportSet=(int*)malloc(bddvarnum*sizeof(int))) == NULL)
{ {
bdd_error(BDD_MEMORY); bdd_error(BDD_MEMORY);