]> git.sur5r.net Git - openldap/commitdiff
plug yet another one-time leak
authorPierangelo Masarati <ando@openldap.org>
Fri, 19 Aug 2005 15:05:03 +0000 (15:05 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 19 Aug 2005 15:05:03 +0000 (15:05 +0000)
libraries/libldap/schema.c

index 182fe94c9c8d9fe642240efed02a9827edb4c1b7..bff6c5bdbe11db353cbb016bc8a49f0a14ea314a 100644 (file)
@@ -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;