summaryrefslogtreecommitdiffstats
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/amap/amapParse.c10
-rw-r--r--src/map/amap/amapRead.c6
-rw-r--r--src/map/if/ifLib.c5
-rw-r--r--src/map/mapper/mapperLib.c1
-rw-r--r--src/map/mapper/mapperMatch.c8
-rw-r--r--src/map/mapper/mapperSuper.c2
-rw-r--r--src/map/mio/mioRead.c3
7 files changed, 31 insertions, 4 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 );
diff --git a/src/map/if/ifLib.c b/src/map/if/ifLib.c
index 90e37a0f..3822302e 100644
--- a/src/map/if/ifLib.c
+++ b/src/map/if/ifLib.c
@@ -73,6 +73,7 @@ If_Lib_t * If_LutLibRead( char * FileName )
if ( i != atoi(pToken) )
{
Abc_Print( 1, "Error in the LUT library file \"%s\".\n", FileName );
+ ABC_FREE( p->pName );
ABC_FREE( p );
return NULL;
}
@@ -89,6 +90,8 @@ If_Lib_t * If_LutLibRead( char * FileName )
// check for out-of-bound
if ( k > i )
{
+ ABC_FREE( p->pName );
+ ABC_FREE( p );
Abc_Print( 1, "LUT %d has too many pins (%d). Max allowed is %d.\n", i, k, i );
return NULL;
}
@@ -99,6 +102,8 @@ If_Lib_t * If_LutLibRead( char * FileName )
if ( i == IF_MAX_LUTSIZE )
{
+ ABC_FREE( p->pName );
+ ABC_FREE( p );
Abc_Print( 1, "Skipping LUTs of size more than %d.\n", i );
return NULL;
}
diff --git a/src/map/mapper/mapperLib.c b/src/map/mapper/mapperLib.c
index 9cc8747d..bd7f9b87 100644
--- a/src/map/mapper/mapperLib.c
+++ b/src/map/mapper/mapperLib.c
@@ -86,6 +86,7 @@ clk = clock();
{
if ( pExcludeFile != 0 )
{
+ Map_SuperLibFree( p );
printf ("Error: Exclude file support not present for old format. Stop.\n");
return NULL;
}
diff --git a/src/map/mapper/mapperMatch.c b/src/map/mapper/mapperMatch.c
index 19dd6939..6a2ad74a 100644
--- a/src/map/mapper/mapperMatch.c
+++ b/src/map/mapper/mapperMatch.c
@@ -93,16 +93,23 @@ int Map_MappingMatches( Map_Man_t * p )
// make sure that at least one non-trival cut is present
if ( pNode->pCuts->pNext == NULL )
{
+ Extra_ProgressBarStop( pProgress );
printf( "\nError: A node in the mapping graph does not have feasible cuts.\n" );
return 0;
}
// match negative phase
if ( !Map_MatchNodePhase( p, pNode, 0 ) )
+ {
+ Extra_ProgressBarStop( pProgress );
return 0;
+ }
// match positive phase
if ( !Map_MatchNodePhase( p, pNode, 1 ) )
+ {
+ Extra_ProgressBarStop( pProgress );
return 0;
+ }
// make sure that at least one phase is mapped
if ( pNode->pCutBest[0] == NULL && pNode->pCutBest[1] == NULL )
@@ -110,6 +117,7 @@ int Map_MappingMatches( Map_Man_t * p )
printf( "\nError: Could not match both phases of AIG node %d.\n", pNode->Num );
printf( "Please make sure that the supergate library has equivalents of AND2 or NAND2.\n" );
printf( "If such supergates exist in the library, report a bug.\n" );
+ Extra_ProgressBarStop( pProgress );
return 0;
}
diff --git a/src/map/mapper/mapperSuper.c b/src/map/mapper/mapperSuper.c
index 3be70541..58deddb7 100644
--- a/src/map/mapper/mapperSuper.c
+++ b/src/map/mapper/mapperSuper.c
@@ -89,7 +89,7 @@ int Map_LibraryReadFile( Map_SuperLib_t * pLib, FILE * pFile )
unsigned uCanon[2];
// skip empty and comment lines
- while ( fgets( pBuffer, 5000, pFile ) != NULL )
+ while ( fgets( pBuffer, 2000, pFile ) != NULL )
{
// skip leading spaces
for ( pTemp = pBuffer; *pTemp == ' ' || *pTemp == '\r' || *pTemp == '\n'; pTemp++ );
diff --git a/src/map/mio/mioRead.c b/src/map/mio/mioRead.c
index eb5d47ea..3b93856c 100644
--- a/src/map/mio/mioRead.c
+++ b/src/map/mio/mioRead.c
@@ -65,7 +65,6 @@ Mio_Library_t * Mio_LibraryRead( void * pAbc, char * FileName, char * ExcludeFil
tExcludeGate = 0;
return 0;
}
-
fprintf ( Abc_FrameReadOut( (Abc_Frame_t *)pAbc ), "Read %d gates from exclude file\n", num );
}
@@ -76,6 +75,8 @@ Mio_Library_t * Mio_LibraryRead( void * pAbc, char * FileName, char * ExcludeFil
if ( pLib != NULL )
printf ( "Warning: Read extended GENLIB format but ignoring extensions\n" );
}
+ if ( tExcludeGate )
+ st_free_table( tExcludeGate );
return pLib;
}