Clean up: Reduce code duplication by introducing a goto label for
freeing hp and exiting. This will make replacing "struct hostent *"
with "struct addrinfo *" more straightforward in this code.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
if (!exp) {
if (!(eep = mkexportent(hname, path, options)) ||
- !(exp = export_create(eep, 0))) {
- if (hp) free (hp);
- return;
- }
- } else if (!updateexportent(&exp->m_export, options)) {
- if (hp) free (hp);
- return;
- }
+ !(exp = export_create(eep, 0)))
+ goto out;
+ } else if (!updateexportent(&exp->m_export, options))
+ goto out;
if (verbose)
printf("exporting %s:%s\n", exp->m_client->m_hostname,
exp->m_changed = 1;
exp->m_warned = 0;
validate_export(exp);
+
+out:
if (hp) free (hp);
}