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>
return false;
}
- el_new = nwrap_entlist_init(ed);
- if (el_new == NULL) {
- return false;
- }
for (cursor = el; cursor->next != NULL; cursor = cursor->next)
{
if (cursor->ed == ed) {
- free(el_new);
return false;
}
}
if (cursor->ed == ed) {
- free(el_new);
+ return false;
+ }
+
+ el_new = nwrap_entlist_init(ed);
+ if (el_new == NULL) {
return false;
}