diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2011-03-27 14:17:12 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2011-03-27 14:17:12 -0700 |
commit | 6c01e8b9f040d591f72882aff08ed21446fbb567 (patch) | |
tree | 71f04dae22291d7321e5bb244462ab1145c47ee6 /src/base/io | |
parent | 1ec437d04b2fcb42054f068525c2a1b21b69fe53 (diff) | |
download | abc-6c01e8b9f040d591f72882aff08ed21446fbb567.tar.gz abc-6c01e8b9f040d591f72882aff08ed21446fbb567.tar.bz2 abc-6c01e8b9f040d591f72882aff08ed21446fbb567.zip |
Fixed a number of small bugs and memory leaks.
Diffstat (limited to 'src/base/io')
-rw-r--r-- | src/base/io/io.c | 1 | ||||
-rw-r--r-- | src/base/io/ioReadBlif.c | 2 | ||||
-rw-r--r-- | src/base/io/ioReadBlifAig.c | 1 | ||||
-rw-r--r-- | src/base/io/ioReadBlifMv.c | 1 | ||||
-rw-r--r-- | src/base/io/ioReadPla.c | 10 | ||||
-rw-r--r-- | src/base/io/ioWriteAiger.c | 2 | ||||
-rw-r--r-- | src/base/io/ioWriteBook.c | 1 |
7 files changed, 17 insertions, 1 deletions
diff --git a/src/base/io/io.c b/src/base/io/io.c index 46cbb33a..1230cd8e 100644 --- a/src/base/io/io.c +++ b/src/base/io/io.c @@ -933,6 +933,7 @@ int IoCommandReadTruth( Abc_Frame_t * pAbc, int argc, char ** argv ) pSopCover = Abc_SopFromTruthBin(argv[globalUtilOptind]); if ( pSopCover == NULL || pSopCover[0] == 0 ) { + ABC_FREE( pSopCover ); fprintf( pAbc->Err, "Reading truth table has failed.\n" ); return 1; } diff --git a/src/base/io/ioReadBlif.c b/src/base/io/ioReadBlif.c index a1241354..9fd41261 100644 --- a/src/base/io/ioReadBlif.c +++ b/src/base/io/ioReadBlif.c @@ -149,9 +149,9 @@ Abc_Ntk_t * Io_ReadBlifNetwork( Io_ReadBlif_t * p ) if ( p->vTokens && strcmp((char *)p->vTokens->pArray[0], ".exdc") == 0 ) { pNtk->pExdc = Io_ReadBlifNetworkOne( p ); - Abc_NtkFinalizeRead( pNtk->pExdc ); if ( pNtk->pExdc == NULL ) break; + Abc_NtkFinalizeRead( pNtk->pExdc ); } // add this network as part of the hierarchy if ( pNtkMaster == NULL ) // no master network so far diff --git a/src/base/io/ioReadBlifAig.c b/src/base/io/ioReadBlifAig.c index caa776f9..1ef61196 100644 --- a/src/base/io/ioReadBlifAig.c +++ b/src/base/io/ioReadBlifAig.c @@ -444,6 +444,7 @@ static char * Io_BlifLoadFile( char * pFileName ) nFileSize = ftell( pFile ); if ( nFileSize == 0 ) { + fclose( pFile ); printf( "Io_BlifLoadFile(): The file is empty.\n" ); return NULL; } diff --git a/src/base/io/ioReadBlifMv.c b/src/base/io/ioReadBlifMv.c index c3612b2d..1c28ac3d 100644 --- a/src/base/io/ioReadBlifMv.c +++ b/src/base/io/ioReadBlifMv.c @@ -538,6 +538,7 @@ static char * Io_MvLoadFile( char * pFileName ) nFileSize = ftell( pFile ); if ( nFileSize == 0 ) { + fclose( pFile ); printf( "Io_MvLoadFile(): The file is empty.\n" ); return NULL; } diff --git a/src/base/io/ioReadPla.c b/src/base/io/ioReadPla.c index 36d44c68..927cf7e5 100644 --- a/src/base/io/ioReadPla.c +++ b/src/base/io/ioReadPla.c @@ -120,6 +120,8 @@ Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros ) printf( "%s (line %d): Wrong number of token.\n", Extra_FileReaderGetFileName(p), iLine+1 ); Abc_NtkDelete( pNtk ); + Extra_ProgressBarStop( pProgress ); + ABC_FREE( ppSops ); return NULL; } @@ -152,6 +154,8 @@ Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros ) { printf( "%s: The number of inputs is not specified.\n", Extra_FileReaderGetFileName(p) ); Abc_NtkDelete( pNtk ); + Extra_ProgressBarStop( pProgress ); + ABC_FREE( ppSops ); return NULL; } nDigits = Extra_Base10Log( nInputs ); @@ -167,6 +171,8 @@ Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros ) { printf( "%s: The number of outputs is not specified.\n", Extra_FileReaderGetFileName(p) ); Abc_NtkDelete( pNtk ); + Extra_ProgressBarStop( pProgress ); + ABC_FREE( ppSops ); return NULL; } nDigits = Extra_Base10Log( nOutputs ); @@ -199,6 +205,8 @@ Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros ) printf( "%s (line %d): Input and output cubes are not specified.\n", Extra_FileReaderGetFileName(p), iLine+1 ); Abc_NtkDelete( pNtk ); + Extra_ProgressBarStop( pProgress ); + ABC_FREE( ppSops ); return NULL; } pCubeIn = (char *)vTokens->pArray[0]; @@ -215,6 +223,8 @@ Abc_Ntk_t * Io_ReadPlaNetwork( Extra_FileReader_t * p, int fZeros ) printf( "%s (line %d): Output cube length (%zu) differs from the number of outputs (%d).\n", Extra_FileReaderGetFileName(p), iLine+1, strlen(pCubeOut), nOutputs ); Abc_NtkDelete( pNtk ); + Extra_ProgressBarStop( pProgress ); + ABC_FREE( ppSops ); return NULL; } if ( fZeros ) diff --git a/src/base/io/ioWriteAiger.c b/src/base/io/ioWriteAiger.c index 3900cf26..1087af4f 100644 --- a/src/base/io/ioWriteAiger.c +++ b/src/base/io/ioWriteAiger.c @@ -668,6 +668,7 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f fprintf( stdout, "Io_WriteAiger(): I/O error writing to compressed stream.\n" ); fclose( b.f ); ABC_FREE(b.buf); + Vec_StrFree( vBinary ); return; } } @@ -694,6 +695,7 @@ void Io_WriteAiger( Abc_Ntk_t * pNtk, char * pFileName, int fWriteSymbols, int f printf( "Io_WriteAiger(): AIGER generation has failed because the allocated buffer is too small.\n" ); fclose( b.f ); ABC_FREE(b.buf); + Extra_ProgressBarStop( pProgress ); return; } } diff --git a/src/base/io/ioWriteBook.c b/src/base/io/ioWriteBook.c index 9d0df473..45807ce6 100644 --- a/src/base/io/ioWriteBook.c +++ b/src/base/io/ioWriteBook.c @@ -117,6 +117,7 @@ void Io_WriteBook( Abc_Ntk_t * pNtk, char * FileName ) // write the aux file if ( (pFileNodes == NULL) || (pFileNets == NULL) || (pFileAux == NULL) ) { + fclose( pFileAux ); fprintf( stdout, "Io_WriteBook(): Cannot open the output files.\n" ); return; } |