summaryrefslogtreecommitdiffstats
path: root/src/map/amap/amapRead.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2011-03-27 14:17:12 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2011-03-27 14:17:12 -0700
commit6c01e8b9f040d591f72882aff08ed21446fbb567 (patch)
tree71f04dae22291d7321e5bb244462ab1145c47ee6 /src/map/amap/amapRead.c
parent1ec437d04b2fcb42054f068525c2a1b21b69fe53 (diff)
downloadabc-6c01e8b9f040d591f72882aff08ed21446fbb567.tar.gz
abc-6c01e8b9f040d591f72882aff08ed21446fbb567.tar.bz2
abc-6c01e8b9f040d591f72882aff08ed21446fbb567.zip
Fixed a number of small bugs and memory leaks.
Diffstat (limited to 'src/map/amap/amapRead.c')
-rw-r--r--src/map/amap/amapRead.c6
1 files changed, 6 insertions, 0 deletions
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 );