From 6c01e8b9f040d591f72882aff08ed21446fbb567 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 27 Mar 2011 14:17:12 -0700 Subject: Fixed a number of small bugs and memory leaks. --- src/map/amap/amapRead.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/map/amap/amapRead.c') 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 ); -- cgit v1.2.3