const char * q;
char * res;
+ *token_val = NULL;
switch (**sp) {
case '\0':
kind = TK_EOS;
res1 = LDAP_REALLOC(res,size*sizeof(char *));
if ( !res1 ) {
LDAP_VFREE(res);
+ LDAP_FREE(sval);
*code = LDAP_SCHERR_OUTOFMEM;
return(NULL);
}
parse_whsp(sp);
} else {
LDAP_VFREE(res);
+ LDAP_FREE(sval);
*code = LDAP_SCHERR_UNEXPTOKEN;
return(NULL);
}
parse_whsp(sp);
return res;
} else {
+ LDAP_FREE(sval);
*code = LDAP_SCHERR_BADNAME;
return NULL;
}
parse_whsp(sp);
kind = get_token(sp, &sval);
if ( kind != TK_BAREWORD ) {
+ LDAP_FREE(sval);
*code = LDAP_SCHERR_UNEXPTOKEN;
return NULL;
}
pos++;
} else {
*code = LDAP_SCHERR_UNEXPTOKEN;
+ LDAP_FREE(sval);
LDAP_VFREE(res);
return NULL;
}
size++;
res1 = LDAP_REALLOC(res,size*sizeof(char *));
if ( !res1 ) {
- LDAP_VFREE(res);
- *code = LDAP_SCHERR_OUTOFMEM;
- return(NULL);
+ LDAP_FREE(sval);
+ LDAP_VFREE(res);
+ *code = LDAP_SCHERR_OUTOFMEM;
+ return(NULL);
}
res = res1;
}
pos++;
} else {
*code = LDAP_SCHERR_UNEXPTOKEN;
+ LDAP_FREE(sval);
LDAP_VFREE(res);
return NULL;
}
parse_whsp(sp);
} else {
*code = LDAP_SCHERR_UNEXPTOKEN;
+ LDAP_FREE(sval);
LDAP_VFREE(res);
return NULL;
}
( allow_quoted && kind == TK_QDSTRING ) ) {
res = LDAP_CALLOC(2,sizeof(char *));
if ( !res ) {
+ LDAP_FREE(sval);
*code = LDAP_SCHERR_OUTOFMEM;
return NULL;
}
parse_whsp(sp);
return res;
} else {
+ LDAP_FREE(sval);
*code = LDAP_SCHERR_BADNAME;
return NULL;
}
kind = get_token(&ss,&sval);
if ( kind != TK_LEFTPAREN ) {
+ LDAP_FREE(sval);
*code = LDAP_SCHERR_NOLEFTPAREN;
ldap_syntax_free(syn);
return NULL;
return syn;
case TK_BAREWORD:
if ( !strcmp(sval,"DESC") ) {
+ LDAP_FREE(sval);
if ( seen_desc ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
if ( kind != TK_QDSTRING ) {
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_syntax_free(syn);
return NULL;
}
syn->syn_desc = sval;
parse_whsp(&ss);
} else if ( sval[0] == 'X' && sval[1] == '-' ) {
+ LDAP_FREE(sval);
/* Should be parse_qdstrings */
ssdummy = parse_qdescrs(&ss, code);
if ( !ssdummy ) {
} else {
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_syntax_free(syn);
return NULL;
}
default:
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_syntax_free(syn);
return NULL;
}
kind = get_token(&ss,&sval);
if ( kind != TK_LEFTPAREN ) {
*code = LDAP_SCHERR_NOLEFTPAREN;
+ LDAP_FREE(sval);
ldap_matchingrule_free(mr);
return NULL;
}
} else {
/* Non-numerical OID, ignore */
}
- }
+ }
+ LDAP_FREE(sval);
} else {
*errp = ss;
ldap_matchingrule_free(mr);
return mr;
case TK_BAREWORD:
if ( !strcmp(sval,"NAME") ) {
+ LDAP_FREE(sval);
if ( seen_name ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
return NULL;
}
} else if ( !strcmp(sval,"DESC") ) {
+ LDAP_FREE(sval);
if ( seen_desc ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
if ( kind != TK_QDSTRING ) {
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_matchingrule_free(mr);
return NULL;
}
mr->mr_desc = sval;
parse_whsp(&ss);
} else if ( !strcmp(sval,"OBSOLETE") ) {
+ LDAP_FREE(sval);
if ( seen_obsolete ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
mr->mr_obsolete = LDAP_SCHEMA_YES;
parse_whsp(&ss);
} else if ( !strcmp(sval,"SYNTAX") ) {
+ LDAP_FREE(sval);
if ( seen_syntax ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
}
parse_whsp(&ss);
} else if ( sval[0] == 'X' && sval[1] == '-' ) {
+ LDAP_FREE(sval);
/* Should be parse_qdstrings */
ssdummy = parse_qdescrs(&ss, code);
if ( !ssdummy ) {
} else {
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_matchingrule_free(mr);
return NULL;
}
default:
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_matchingrule_free(mr);
return NULL;
}
kind = get_token(&ss,&sval);
if ( kind != TK_LEFTPAREN ) {
*code = LDAP_SCHERR_NOLEFTPAREN;
+ LDAP_FREE(sval);
ldap_attributetype_free(at);
return NULL;
}
} else {
/* Non-numerical OID, ignore */
}
- }
+ }
+ LDAP_FREE(sval);
} else {
*errp = ss;
ldap_attributetype_free(at);
return at;
case TK_BAREWORD:
if ( !strcmp(sval,"NAME") ) {
+ LDAP_FREE(sval);
if ( seen_name ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
return NULL;
}
} else if ( !strcmp(sval,"DESC") ) {
+ LDAP_FREE(sval);
if ( seen_desc ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
if ( kind != TK_QDSTRING ) {
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_attributetype_free(at);
return NULL;
}
at->at_desc = sval;
parse_whsp(&ss);
} else if ( !strcmp(sval,"OBSOLETE") ) {
+ LDAP_FREE(sval);
if ( seen_obsolete ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
at->at_obsolete = LDAP_SCHEMA_YES;
parse_whsp(&ss);
} else if ( !strcmp(sval,"SUP") ) {
+ LDAP_FREE(sval);
if ( seen_sup ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
return NULL;
}
} else if ( !strcmp(sval,"EQUALITY") ) {
+ LDAP_FREE(sval);
if ( seen_equality ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
return NULL;
}
} else if ( !strcmp(sval,"ORDERING") ) {
+ LDAP_FREE(sval);
if ( seen_ordering ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
return NULL;
}
} else if ( !strcmp(sval,"SUBSTR") ) {
+ LDAP_FREE(sval);
if ( seen_substr ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
return NULL;
}
} else if ( !strcmp(sval,"SYNTAX") ) {
+ LDAP_FREE(sval);
if ( seen_syntax ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
}
parse_whsp(&ss);
} else if ( !strcmp(sval,"SINGLE-VALUE") ) {
+ LDAP_FREE(sval);
if ( at->at_single_value ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
at->at_single_value = LDAP_SCHEMA_YES;
parse_whsp(&ss);
} else if ( !strcmp(sval,"COLLECTIVE") ) {
+ LDAP_FREE(sval);
if ( at->at_collective ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
at->at_collective = LDAP_SCHEMA_YES;
parse_whsp(&ss);
} else if ( !strcmp(sval,"NO-USER-MODIFICATION") ) {
+ LDAP_FREE(sval);
if ( at->at_no_user_mod ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
at->at_no_user_mod = LDAP_SCHEMA_YES;
parse_whsp(&ss);
} else if ( !strcmp(sval,"USAGE") ) {
+ LDAP_FREE(sval);
if ( seen_usage ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
if ( kind != TK_BAREWORD ) {
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_attributetype_free(at);
return NULL;
}
else {
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_attributetype_free(at);
return NULL;
}
+ LDAP_FREE(sval);
parse_whsp(&ss);
} else if ( sval[0] == 'X' && sval[1] == '-' ) {
+ LDAP_FREE(sval);
/* Should be parse_qdstrings */
ssdummy = parse_qdescrs(&ss, code);
if ( !ssdummy ) {
} else {
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_attributetype_free(at);
return NULL;
}
default:
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_attributetype_free(at);
return NULL;
}
kind = get_token(&ss,&sval);
if ( kind != TK_LEFTPAREN ) {
*code = LDAP_SCHERR_NOLEFTPAREN;
+ LDAP_FREE(sval);
ldap_objectclass_free(oc);
return NULL;
}
} else {
/* Non-numerical OID, ignore */
}
- }
+ }
+ LDAP_FREE(sval);
} else {
*errp = ss;
ldap_objectclass_free(oc);
return oc;
case TK_BAREWORD:
if ( !strcmp(sval,"NAME") ) {
+ LDAP_FREE(sval);
if ( seen_name ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
return NULL;
}
} else if ( !strcmp(sval,"DESC") ) {
+ LDAP_FREE(sval);
if ( seen_desc ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
if ( kind != TK_QDSTRING ) {
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_objectclass_free(oc);
return NULL;
}
oc->oc_desc = sval;
parse_whsp(&ss);
} else if ( !strcmp(sval,"OBSOLETE") ) {
+ LDAP_FREE(sval);
if ( seen_obsolete ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
oc->oc_obsolete = LDAP_SCHEMA_YES;
parse_whsp(&ss);
} else if ( !strcmp(sval,"SUP") ) {
+ LDAP_FREE(sval);
if ( seen_sup ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
return NULL;
}
} else if ( !strcmp(sval,"ABSTRACT") ) {
+ LDAP_FREE(sval);
if ( seen_kind ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
oc->oc_kind = LDAP_SCHEMA_ABSTRACT;
parse_whsp(&ss);
} else if ( !strcmp(sval,"STRUCTURAL") ) {
+ LDAP_FREE(sval);
if ( seen_kind ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
oc->oc_kind = LDAP_SCHEMA_STRUCTURAL;
parse_whsp(&ss);
} else if ( !strcmp(sval,"AUXILIARY") ) {
+ LDAP_FREE(sval);
if ( seen_kind ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
oc->oc_kind = LDAP_SCHEMA_AUXILIARY;
parse_whsp(&ss);
} else if ( !strcmp(sval,"MUST") ) {
+ LDAP_FREE(sval);
if ( seen_must ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
}
parse_whsp(&ss);
} else if ( !strcmp(sval,"MAY") ) {
+ LDAP_FREE(sval);
if ( seen_may ) {
*code = LDAP_SCHERR_DUPOPT;
*errp = ss;
}
parse_whsp(&ss);
} else if ( sval[0] == 'X' && sval[1] == '-' ) {
+ LDAP_FREE(sval);
/* Should be parse_qdstrings */
ssdummy = parse_qdescrs(&ss, code);
if ( !ssdummy ) {
} else {
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_objectclass_free(oc);
return NULL;
}
default:
*code = LDAP_SCHERR_UNEXPTOKEN;
*errp = ss;
+ LDAP_FREE(sval);
ldap_objectclass_free(oc);
return NULL;
}