diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2018-05-19 12:22:08 +0900 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2018-05-19 12:22:08 +0900 |
commit | e68c6c6281ffc1ea98706fd6761faaf5a799a0f4 (patch) | |
tree | 99276613781f26fcbc122d7e78f373432b8717ce /src/misc/vec | |
parent | d9e68f60c84e187cb3759a931e416b9f791269fe (diff) | |
download | abc-e68c6c6281ffc1ea98706fd6761faaf5a799a0f4.tar.gz abc-e68c6c6281ffc1ea98706fd6761faaf5a799a0f4.tar.bz2 abc-e68c6c6281ffc1ea98706fd6761faaf5a799a0f4.zip |
Fix to prevent undefined behavior.
Diffstat (limited to 'src/misc/vec')
-rw-r--r-- | src/misc/vec/vecInt.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index 092d95b4..a0527ab9 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -127,7 +127,7 @@ static inline Vec_Int_t * Vec_IntStart( int nSize ) Vec_Int_t * p; p = Vec_IntAlloc( nSize ); p->nSize = nSize; - memset( p->pArray, 0, sizeof(int) * nSize ); + if ( p->pArray ) memset( p->pArray, 0, sizeof(int) * nSize ); return p; } static inline Vec_Int_t * Vec_IntStartFull( int nSize ) @@ -135,7 +135,7 @@ static inline Vec_Int_t * Vec_IntStartFull( int nSize ) Vec_Int_t * p; p = Vec_IntAlloc( nSize ); p->nSize = nSize; - memset( p->pArray, 0xff, sizeof(int) * nSize ); + if ( p->pArray ) memset( p->pArray, 0xff, sizeof(int) * nSize ); return p; } static inline Vec_Int_t * Vec_IntStartRange( int First, int Range ) |