mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
nwrap: Small code shift in nwrap_ed_inventarize_add_to_existing()
Allocate memory only when necessary. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
db0ef5cc9e
commit
16b71aecab
@ -2610,21 +2610,20 @@ static bool nwrap_ed_inventarize_add_to_existing(struct nwrap_entdata *const ed,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
el_new = nwrap_entlist_init(ed);
|
|
||||||
if (el_new == NULL) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (cursor = el; cursor->next != NULL; cursor = cursor->next)
|
for (cursor = el; cursor->next != NULL; cursor = cursor->next)
|
||||||
{
|
{
|
||||||
if (cursor->ed == ed) {
|
if (cursor->ed == ed) {
|
||||||
free(el_new);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor->ed == ed) {
|
if (cursor->ed == ed) {
|
||||||
free(el_new);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
el_new = nwrap_entlist_init(ed);
|
||||||
|
if (el_new == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user