diff --git a/DriverManager/SQLDriverConnect.c b/DriverManager/SQLDriverConnect.c index bbfc4c8..fd51d3f 100644 --- a/DriverManager/SQLDriverConnect.c +++ b/DriverManager/SQLDriverConnect.c @@ -465,6 +465,8 @@ struct con_pair * con_p; if ( keyword ) { con_p = malloc( sizeof( *con_p )); + if ( !con_p ) + return NULL; con_p -> keyword = keyword; con_p -> attribute = value; return con_p; diff --git a/odbcinst/SQLCreateDataSource.c b/odbcinst/SQLCreateDataSource.c index 9c41bab..58cf63b 100644 --- a/odbcinst/SQLCreateDataSource.c +++ b/odbcinst/SQLCreateDataSource.c @@ -40,6 +40,8 @@ char* _multi_string_alloc_and_copy( LPCWSTR in ) } chr = malloc( len + 2 ); + if ( !chr ) + return NULL; len = 0; while ( in[ len ] != 0 || in[ len + 1 ] != 0 ) @@ -80,6 +82,8 @@ char* _single_string_alloc_and_copy( LPCWSTR in ) } chr = malloc( ulen + 1 ); + if ( !chr ) + return NULL; len = 0; ulen = 0; @@ -127,6 +131,8 @@ char* _single_string_alloc_and_copy( LPCWSTR in ) } chr = malloc( len + 1 ); + if ( !chr ) + return NULL; len = 0; while ( in[ len ] != 0 ) @@ -157,6 +163,8 @@ SQLWCHAR* _multi_string_alloc_and_expand( LPCSTR in ) } chr = malloc(sizeof( SQLWCHAR ) * ( len + 2 )); + if ( !chr ) + return NULL; len = 0; while ( in[ len ] != 0 || in[ len + 1 ] != 0 ) @@ -186,6 +194,8 @@ SQLWCHAR* _single_string_alloc_and_expand( LPCSTR in ) } chr = malloc( sizeof( SQLWCHAR ) * ( len + 1 )); + if ( !chr ) + return NULL; len = 0; while ( in[ len ] != 0 )