From: Pierangelo Masarati Date: Fri, 19 Aug 2005 15:05:03 +0000 (+0000) Subject: plug yet another one-time leak X-Git-Tag: OPENLDAP_REL_ENG_2_2_MP~655 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7732236996d5185a0f62ef35ac6d7d9abad6c70b;p=openldap plug yet another one-time leak --- diff --git a/libraries/libldap/schema.c b/libraries/libldap/schema.c index 182fe94c9c..bff6c5bdbe 100644 --- a/libraries/libldap/schema.c +++ b/libraries/libldap/schema.c @@ -1250,11 +1250,11 @@ parse_noidlen(const char **sp, int *code, int *len, int flags) && *sp == savepos && *code == LDAP_SCHERR_NODIGIT ) { - if ( get_token(sp, &sval) == TK_BAREWORD ) { - int len = *sp - savepos; - sval = LDAP_MALLOC(len+1); - strncpy(sval, savepos, len); - sval[len] = '\0'; + if ( get_token(sp, &sval) != TK_BAREWORD ) { + if ( sval != NULL ) { + LDAP_FREE(sval); + } + return NULL; } } else { return NULL;