/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2000-2004 The OpenLDAP Foundation.
+ * Copyright 2000-2011 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
/*
* Keep only single escapes '%'
*/
- if ( p[ 0 ] != REWRITE_SUBMATCH_ESCAPE ) {
+ if ( !IS_REWRITE_SUBMATCH_ESCAPE( p[ 0 ] ) ) {
continue;
}
- if ( p[ 1 ] == REWRITE_SUBMATCH_ESCAPE ) {
+ if ( IS_REWRITE_SUBMATCH_ESCAPE( p[ 1 ] ) ) {
/* Pull &p[1] over p, including the trailing '\0' */
AC_MEMCPY((char *)p, &p[ 1 ], strlen( p ) );
continue;
subs_len += l;
subs[ nsub ].bv_len = l;
subs[ nsub ].bv_val = malloc( l + 1 );
+ if ( subs[ nsub ].bv_val == NULL ) {
+ free( subs );
+ goto cleanup;
+ }
AC_MEMCPY( subs[ nsub ].bv_val, begin, l );
subs[ nsub ].bv_val[ l ] = '\0';
} else {
if ( rc != REWRITE_SUCCESS ) {
rc = REWRITE_REGEXEC_ERR;
+ goto cleanup;
}
/*
int n;
struct rewrite_subst *subst;
- assert( psubst );
- assert( *psubst );
+ assert( psubst != NULL );
+ assert( *psubst != NULL );
subst = *psubst;