/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2000-2007 The OpenLDAP Foundation.
+ * Copyright 2000-2011 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
*/
l = p - string - 1;
s = calloc( sizeof( char ), l + 1 );
+ if ( s == NULL ) {
+ return NULL;
+ }
AC_MEMCPY( s, string, l );
s[ l ] = 0;
*/
map->lm_type = REWRITE_MAP_SUBCONTEXT;
map->lm_name = strdup( s + 1 );
+ if ( map->lm_name == NULL ) {
+ rc = -1;
+ goto cleanup;
+ }
map->lm_data = rewrite_context_find( info, s + 1 );
if ( map->lm_data == NULL ) {
rc = -1;
map->lm_name = strdup( s + 1 );
}
}
+ if ( map->lm_name == NULL ) {
+ rc = -1;
+ goto cleanup;
+ }
break;
/*
map->lm_type = REWRITE_MAP_GET_OP_VAR;
map->lm_name = strdup( s + 1 );
}
+ if ( map->lm_name == NULL ) {
+ rc = -1;
+ goto cleanup;
+ }
break;
/*
case REWRITE_OPERATOR_PARAM_GET: /* '$' */
map->lm_type = REWRITE_MAP_GET_PARAM;
map->lm_name = strdup( s + 1 );
+ if ( map->lm_name == NULL ) {
+ rc = -1;
+ goto cleanup;
+ }
break;
/*
default:
map->lm_type = REWRITE_MAP_BUILTIN;
map->lm_name = strdup( s );
+ if ( map->lm_name == NULL ) {
+ rc = -1;
+ goto cleanup;
+ }
map->lm_data = rewrite_builtin_map_find( info, s );
if ( map->lm_data == NULL ) {
rc = -1;
rc = rewrite_var_set( &op->lo_vars, map->lm_name,
key->bv_val, 1 )
? REWRITE_SUCCESS : REWRITE_ERR;
- if ( map->lm_type == REWRITE_MAP_SET_OP_VAR ) {
- val->bv_val = strdup( "" );
- } else {
- val->bv_val = strdup( key->bv_val );
- val->bv_len = key->bv_len;
+ if ( rc == REWRITE_SUCCESS ) {
+ if ( map->lm_type == REWRITE_MAP_SET_OP_VAR ) {
+ val->bv_val = strdup( "" );
+ } else {
+ val->bv_val = strdup( key->bv_val );
+ val->bv_len = key->bv_len;
+ }
+ if ( val->bv_val == NULL ) {
+ rc = REWRITE_ERR;
+ }
}
break;
} else {
val->bv_val = strdup( var->lv_value.bv_val );
val->bv_len = var->lv_value.bv_len;
+ if ( val->bv_val == NULL ) {
+ rc = REWRITE_ERR;
+ }
}
break;
}
}
rc = rewrite_session_var_set( info, op->lo_cookie,
map->lm_name, key->bv_val );
- if ( map->lm_type == REWRITE_MAP_SET_SESN_VAR ) {
- val->bv_val = strdup( "" );
- } else {
- val->bv_val = strdup( key->bv_val );
- val->bv_len = key->bv_len;
+ if ( rc == REWRITE_SUCCESS ) {
+ if ( map->lm_type == REWRITE_MAP_SET_SESN_VAR ) {
+ val->bv_val = strdup( "" );
+ } else {
+ val->bv_val = strdup( key->bv_val );
+ val->bv_len = key->bv_len;
+ }
+ if ( val->bv_val == NULL ) {
+ rc = REWRITE_ERR;
+ }
}
break;