mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
on't use freed memory; streamline parse error reporting
This commit is contained in:
parent
2b0bccc74c
commit
42bf993798
@ -147,18 +147,27 @@ parse_cr(
|
|||||||
"%s: line %d: Content rule has no OID\n",
|
"%s: line %d: Content rule has no OID\n",
|
||||||
fname, lineno );
|
fname, lineno );
|
||||||
cr_usage();
|
cr_usage();
|
||||||
return 1;
|
code = 1;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = cr_add( cr, 1, scr, &err );
|
code = cr_add( cr, 1, scr, &err );
|
||||||
if ( code ) {
|
if ( code ) {
|
||||||
fprintf( stderr, "%s: line %d: %s: \"%s\"\n",
|
fprintf( stderr, "%s: line %d: %s: \"%s\"\n",
|
||||||
fname, lineno, scherr2str( code ), err );
|
fname, lineno, scherr2str( code ), err );
|
||||||
return 1;
|
code = 1;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:;
|
||||||
|
if ( code ) {
|
||||||
|
ldap_contentrule_free( cr );
|
||||||
|
|
||||||
|
} else {
|
||||||
ldap_memfree( cr );
|
ldap_memfree( cr );
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -186,18 +195,27 @@ parse_oc(
|
|||||||
"%s: line %d: objectclass has no OID\n",
|
"%s: line %d: objectclass has no OID\n",
|
||||||
fname, lineno );
|
fname, lineno );
|
||||||
oc_usage();
|
oc_usage();
|
||||||
return 1;
|
code = 1;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = oc_add( oc, 1, soc, &err );
|
code = oc_add( oc, 1, soc, &err );
|
||||||
if ( code ) {
|
if ( code ) {
|
||||||
fprintf( stderr, "%s: line %d: %s: \"%s\"\n",
|
fprintf( stderr, "%s: line %d: %s: \"%s\"\n",
|
||||||
fname, lineno, scherr2str( code ), err );
|
fname, lineno, scherr2str( code ), err );
|
||||||
return 1;
|
code = 1;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:;
|
||||||
|
if ( code ) {
|
||||||
|
ldap_objectclass_free( oc );
|
||||||
|
|
||||||
|
} else {
|
||||||
ldap_memfree( oc );
|
ldap_memfree( oc );
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -268,23 +286,33 @@ parse_at(
|
|||||||
"%s: line %d: attributeType has no OID\n",
|
"%s: line %d: attributeType has no OID\n",
|
||||||
fname, lineno );
|
fname, lineno );
|
||||||
at_usage();
|
at_usage();
|
||||||
return 1;
|
code = 1;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* operational attributes should be defined internally */
|
/* operational attributes should be defined internally */
|
||||||
if ( at->at_usage ) {
|
if ( at->at_usage ) {
|
||||||
fprintf( stderr, "%s: line %d: attribute type \"%s\" is operational\n",
|
fprintf( stderr, "%s: line %d: attribute type \"%s\" is operational\n",
|
||||||
fname, lineno, at->at_oid );
|
fname, lineno, at->at_oid );
|
||||||
return 1;
|
code = 1;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = at_add( at, 1, sat, &err);
|
code = at_add( at, 1, sat, &err);
|
||||||
if ( code ) {
|
if ( code ) {
|
||||||
ldap_attributetype_free( at );
|
|
||||||
fprintf( stderr, "%s: line %d: %s: \"%s\"\n",
|
fprintf( stderr, "%s: line %d: %s: \"%s\"\n",
|
||||||
fname, lineno, scherr2str(code), err);
|
fname, lineno, scherr2str(code), err);
|
||||||
return 1;
|
code = 1;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:;
|
||||||
|
if ( code ) {
|
||||||
|
ldap_attributetype_free( at );
|
||||||
|
|
||||||
|
} else {
|
||||||
ldap_memfree( at );
|
ldap_memfree( at );
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user