[unixODBC-dev] Add the NULL pointer check in some functions

Nick Gorham nick at lurcher.org
Wed Nov 19 09:38:37 GMT 2014


On 19/11/14 08:41, xiaonan wrote:
> Hi Nick,
>
> At the beginning of the __validate_stmt(), the function will check 
> whether the statement is NULL or not:
> int __validate_stmt( DMHSTMT statement )
> {
> #ifdef FAST_HANDLE_VALIDATE
>
> if ( statement && *(( int * ) statement ) == HSTMT_MAGIC )
> return 1;
> else
> return 0;
>
> #else
> ......
> #endif
> }
> So I think __validate_env(), __validate_dbc() and __validate_desc() 
> should all add this protection. E.g.:
> int __validate_env( DMHENV env )
> {

Yes, thats worth adding. I will do so.

-- 
Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-dev/attachments/20141119/8d518492/attachment.html>


More information about the unixODBC-dev mailing list