Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nadezhda Ivanova
OpenLDAP
Commits
878d489e
Commit
878d489e
authored
Aug 30, 1999
by
Kurt Zeilenga
Browse files
Do not overwrite charray argument if charray_add realloc fails.
Caller is required to call ldap_charray_free as needed.
parent
93c7bccd
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/libldap/charray.c
View file @
878d489e
...
...
@@ -24,17 +24,27 @@ ldap_charray_add(
if
(
*
a
==
NULL
)
{
*
a
=
(
char
**
)
LDAP_MALLOC
(
2
*
sizeof
(
char
*
)
);
n
=
0
;
if
(
*
a
==
NULL
)
{
return
-
1
;
}
}
else
{
char
**
new
;
for
(
n
=
0
;
*
a
!=
NULL
&&
(
*
a
)[
n
]
!=
NULL
;
n
++
)
{
;
/* NULL */
}
*
a
=
(
char
**
)
LDAP_REALLOC
(
(
char
*
)
*
a
,
new
=
(
char
**
)
LDAP_REALLOC
(
(
char
*
)
*
a
,
(
n
+
2
)
*
sizeof
(
char
*
)
);
}
if
(
*
a
==
NULL
)
{
return
-
1
;
if
(
new
==
NULL
)
{
/* caller is required to call ldap_charray_free(*a) */
return
-
1
;
}
*
a
=
new
;
}
(
*
a
)[
n
]
=
LDAP_STRDUP
(
s
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment