mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-09 02:52:04 +08:00
Use calloc properly... could result in too few bytes being allocated.
calloc(1, nelem*size) -> calloc(nelem, size)
This commit is contained in:
parent
94b8e0830e
commit
ab64c237f7
@ -181,8 +181,7 @@ parse_acl(
|
||||
* by clause consists of <who> and <access>
|
||||
*/
|
||||
|
||||
b = (struct access *) ch_calloc( 1,
|
||||
sizeof(struct access) );
|
||||
b = (struct access *) ch_calloc( 1, sizeof(struct access) );
|
||||
|
||||
if ( ++i == argc ) {
|
||||
fprintf( stderr,
|
||||
|
@ -74,7 +74,7 @@ slapd_daemon(
|
||||
}
|
||||
#endif /* !FD_SETSIZE */
|
||||
|
||||
c = (Connection *) ch_calloc( 1, dtblsize * sizeof(Connection) );
|
||||
c = (Connection *) ch_calloc( (size_t) dtblsize, sizeof(Connection) );
|
||||
|
||||
for ( i = 0; i < dtblsize; i++ ) {
|
||||
c[i].c_dn = NULL;
|
||||
|
@ -244,8 +244,7 @@ add_lastmods( Operation *op, LDAPModList **modlist )
|
||||
tmp = (LDAPModList *) ch_calloc( 1, sizeof(LDAPModList) );
|
||||
tmp->ml_type = ch_strdup( "modifiersname" );
|
||||
tmp->ml_op = LDAP_MOD_REPLACE;
|
||||
tmp->ml_bvalues = (struct berval **) ch_calloc( 1,
|
||||
2 * sizeof(struct berval *) );
|
||||
tmp->ml_bvalues = (struct berval **) ch_calloc(2, sizeof(struct berval *));
|
||||
tmp->ml_bvalues[0] = ber_bvdup( &bv );
|
||||
tmp->ml_next = *modlist;
|
||||
*modlist = tmp;
|
||||
@ -264,7 +263,7 @@ add_lastmods( Operation *op, LDAPModList **modlist )
|
||||
tmp = (LDAPModList *) ch_calloc( 1, sizeof(LDAPModList) );
|
||||
tmp->ml_type = ch_strdup( "modifytimestamp" );
|
||||
tmp->ml_op = LDAP_MOD_REPLACE;
|
||||
tmp->ml_bvalues = (struct berval **) ch_calloc( 1, 2 * sizeof(struct berval *) );
|
||||
tmp->ml_bvalues = (struct berval **) ch_calloc(2, sizeof(struct berval *));
|
||||
tmp->ml_bvalues[0] = ber_bvdup( &bv );
|
||||
tmp->ml_next = *modlist;
|
||||
*modlist = tmp;
|
||||
|
Loading…
Reference in New Issue
Block a user