1
0
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:
Robin Hack 2015-11-16 23:38:51 +01:00 committed by Michael Adam
parent db0ef5cc9e
commit 16b71aecab

View File

@ -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;
} }