]> git.sur5r.net Git - openldap/commitdiff
ITS#3065: fix vector handling to ensure its free()able
authorKurt Zeilenga <kurt@openldap.org>
Wed, 7 Apr 2004 18:58:32 +0000 (18:58 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 7 Apr 2004 18:58:32 +0000 (18:58 +0000)
libraries/libldap/schema.c

index 9da7f3540926ec8a3475f4796a49fb5c172c85db..5f8db3196bf4881b1093bc646cc52c1c26b7c139 100644 (file)
@@ -1183,8 +1183,8 @@ parse_qdescrs(const char **sp, int *code)
                                        }
                                        res = res1;
                                }
-                               res[pos] = sval;
-                               pos++;
+                               res[pos++] = sval;
+                               res[pos] = NULL;
                                parse_whsp(sp);
                        } else {
                                LDAP_VFREE(res);
@@ -1193,7 +1193,6 @@ parse_qdescrs(const char **sp, int *code)
                                return(NULL);
                        }
                }
-               res[pos] = NULL;
                parse_whsp(sp);
                return(res);
        } else if ( kind == TK_QDESCR ) {
@@ -1311,8 +1310,8 @@ parse_oids(const char **sp, int *code, const int allow_quoted)
                kind = get_token(sp,&sval);
                if ( kind == TK_BAREWORD ||
                     ( allow_quoted && kind == TK_QDSTRING ) ) {
-                       res[pos] = sval;
-                       pos++;
+                       res[pos++] = sval;
+                       res[pos] = NULL;
                } else {
                        *code = LDAP_SCHERR_UNEXPTOKEN;
                        LDAP_FREE(sval);
@@ -1341,8 +1340,8 @@ parse_oids(const char **sp, int *code, const int allow_quoted)
                                                }
                                                res = res1;
                                        }
-                                       res[pos] = sval;
-                                       pos++;
+                                       res[pos++] = sval;
+                                       res[pos] = NULL;
                                } else {
                                        *code = LDAP_SCHERR_UNEXPTOKEN;
                                        LDAP_FREE(sval);
@@ -1357,7 +1356,6 @@ parse_oids(const char **sp, int *code, const int allow_quoted)
                                return NULL;
                        }
                }
-               res[pos] = NULL;
                parse_whsp(sp);
                return(res);
        } else if ( kind == TK_BAREWORD ||