/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1999-2005 The OpenLDAP Foundation.
+ * Copyright 1999-2007 The OpenLDAP Foundation.
* Portions Copyright 1999 Dmitry Kovalev.
* Portions Copyright 2002 Pierangelo Masarati.
* Portions Copyright 2004 Mark Adamson.
row->col_names = (BerVarray)ber_memcalloc_x( row->ncols + 1,
sizeof( struct berval ), ctx );
+ if ( !row->col_names ) goto nomem3;
row->cols = (char **)ber_memcalloc_x( row->ncols + 1,
sizeof( char * ), ctx );
+ if ( !row->cols ) goto nomem2;
row->col_prec = (UDWORD *)ber_memcalloc_x( row->ncols,
sizeof( UDWORD ), ctx );
+ if ( !row->col_prec ) goto nomem1;
row->value_len = (SQLINTEGER *)ber_memcalloc_x( row->ncols,
sizeof( SQLINTEGER ), ctx );
+ if ( !row->value_len ) {
+ ber_memfree_x( row->col_prec, ctx );
+ row->col_prec = NULL;
+nomem1: ber_memfree_x( row->cols, ctx );
+ row->cols = NULL;
+nomem2: ber_memfree_x( row->col_names, ctx );
+ row->col_names = NULL;
+nomem3: Debug( LDAP_DEBUG_ANY, "backsql_BindRowAsStrings: "
+ "out of memory\n", 0, 0, 0 );
+ return LDAP_NO_MEMORY;
+ }
for ( i = 1; i <= row->ncols; i++ ) {
rc = SQLDescribeCol( sth, (SQLSMALLINT)i, &colname[ 0 ],
(SQLUINTEGER)( sizeof( colname ) - 1 ),