Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Ng
OpenLDAP
Commits
62266842
Commit
62266842
authored
22 years ago
by
Howard Chu
Browse files
Options
Downloads
Patches
Plain Diff
Eliminate an unnecessary malloc/free
parent
f1047b70
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/liblutil/passwd.c
+4
-13
4 additions, 13 deletions
libraries/liblutil/passwd.c
with
4 additions
and
13 deletions
libraries/liblutil/passwd.c
+
4
−
13
View file @
62266842
...
...
@@ -269,6 +269,7 @@ static int is_allowed_scheme(
static
struct
berval
*
passwd_scheme
(
const
struct
pw_scheme
*
scheme
,
const
struct
berval
*
passwd
,
struct
berval
*
bv
,
const
char
**
allowed
)
{
if
(
!
is_allowed_scheme
(
scheme
->
name
.
bv_val
,
allowed
)
)
{
...
...
@@ -277,10 +278,6 @@ static struct berval *passwd_scheme(
if
(
passwd
->
bv_len
>=
scheme
->
name
.
bv_len
)
{
if
(
strncasecmp
(
passwd
->
bv_val
,
scheme
->
name
.
bv_val
,
scheme
->
name
.
bv_len
)
==
0
)
{
struct
berval
*
bv
=
ber_memalloc
(
sizeof
(
struct
berval
)
);
if
(
bv
==
NULL
)
return
NULL
;
bv
->
bv_val
=
&
passwd
->
bv_val
[
scheme
->
name
.
bv_len
];
bv
->
bv_len
=
passwd
->
bv_len
-
scheme
->
name
.
bv_len
;
...
...
@@ -310,18 +307,12 @@ lutil_passwd(
for
(
i
=
0
;
pw_schemes
[
i
].
name
.
bv_val
!=
NULL
;
i
++
)
{
if
(
pw_schemes
[
i
].
chk_fn
)
{
struct
berval
x
;
struct
berval
*
p
=
passwd_scheme
(
&
pw_schemes
[
i
],
passwd
,
schemes
);
passwd
,
&
x
,
schemes
);
if
(
p
!=
NULL
)
{
int
rc
=
(
pw_schemes
[
i
].
chk_fn
)(
&
pw_schemes
[
i
],
p
,
cred
);
/* only free the berval structure as the bv_val points
* into passwd->bv_val
*/
ber_memfree
(
p
);
return
rc
;
return
(
pw_schemes
[
i
].
chk_fn
)(
&
pw_schemes
[
i
],
p
,
cred
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment