summaryrefslogtreecommitdiffstats
path: root/src/map/amap
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/amap')
-rw-r--r--src/map/amap/amapParse.c10
-rw-r--r--src/map/amap/amapRead.c6
2 files changed, 14 insertions, 2 deletions
diff --git a/src/map/amap/amapParse.c b/src/map/amap/amapParse.c
index 3ebbec11..49c1eb66 100644
--- a/src/map/amap/amapParse.c
+++ b/src/map/amap/amapParse.c
@@ -235,6 +235,8 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa
{
fprintf( pOutput, "Amap_ParseFormula(): Unknown operation\n" );
ABC_FREE( pFormula );
+ Vec_PtrFreeP( &pStackFn );
+ Vec_IntFreeP( &pStackOp );
return NULL;
}
}
@@ -333,6 +335,8 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa
{
fprintf( pOutput, "Amap_ParseFormula(): Unknown operation\n" );
ABC_FREE( pFormula );
+ Vec_PtrFreeP( &pStackFn );
+ Vec_IntFreeP( &pStackOp );
return NULL;
}
Vec_IntPush( pStackOp, Oper1 ); // push the last operation back
@@ -354,10 +358,10 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa
if ( Vec_PtrSize(pStackFn) == 0 )
if ( Vec_IntSize( pStackOp ) == 0 )
{
- Vec_PtrFree(pStackFn);
- Vec_IntFree(pStackOp);
// Cudd_Deref( gFunc );
ABC_FREE( pFormula );
+ Vec_PtrFreeP( &pStackFn );
+ Vec_IntFreeP( &pStackOp );
return gFunc;
}
else
@@ -369,6 +373,8 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa
fprintf( pOutput, "Amap_ParseFormula(): The input string is empty\n" );
}
ABC_FREE( pFormula );
+ Vec_PtrFreeP( &pStackFn );
+ Vec_IntFreeP( &pStackOp );
return NULL;
}
diff --git a/src/map/amap/amapRead.c b/src/map/amap/amapRead.c
index ec169773..77292099 100644
--- a/src/map/amap/amapRead.c
+++ b/src/map/amap/amapRead.c
@@ -331,6 +331,7 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose )
{
if ( strcmp( pToken, AMAP_STRING_GATE ) )
{
+ Amap_LibFree( p );
printf( "The first line should begin with %s.\n", AMAP_STRING_GATE );
return NULL;
}
@@ -358,6 +359,7 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose )
pToken = (char *)Vec_PtrEntry(vTokens, iPos++);
if ( strcmp( pToken, AMAP_STRING_PIN ) )
{
+ Amap_LibFree( p );
printf( "Cannot parse gate %s.\n", pGate->pName );
return NULL;
}
@@ -373,6 +375,7 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose )
pPin->Phase = AMAP_PHASE_NONINV;
else
{
+ Amap_LibFree( p );
printf( "Cannot read phase of pin %s of gate %s\n", pPin->pName, pGate->pName );
return NULL;
}
@@ -429,7 +432,10 @@ Amap_Lib_t * Amap_LibReadFile( char * pFileName, int fVerbose )
vTokens = Amap_DeriveTokens( pBuffer );
pLib = Amap_ParseTokens( vTokens, fVerbose );
if ( pLib == NULL )
+ {
+ Vec_PtrFree( vTokens );
return NULL;
+ }
pLib->pName = Amap_ParseStrsav( pLib->pMemGates, pFileName );
Vec_PtrFree( vTokens );
ABC_FREE( pBuffer );