@@ -1765,17 +1765,21 @@ nsdb_list_find_entries_s(nsdb_t host, const char *nce, char ***fsns)
}
}
- if (retval == FEDFS_OK) {
- if (tmp[0] == NULL) {
- xlog(D_CALL, "%s: No FSN entries under %s",
- __func__, nce);
- retval = FEDFS_ERR_NSDB_NOFSN;
- } else {
- xlog(D_CALL, "%s: returning fsn list", __func__);
- *fsns = tmp;
- }
- } else
+ if (retval != FEDFS_OK) {
nsdb_free_string_array(tmp);
+ goto out;
+ }
+
+ if (tmp[0] == NULL) {
+ xlog(D_CALL, "%s: No FSN entries under %s",
+ __func__, nce);
+ nsdb_free_string_array(tmp);
+ retval = FEDFS_ERR_NSDB_NOFSN;
+ goto out;
+ }
+
+ xlog(D_CALL, "%s: returning fsn list", __func__);
+ *fsns = tmp;
out:
ldap_msgfree(response);
Rewrite the tail of nsdb_list_find_entries_s() in bfields-normal form to ensure "tmp" is freed if the return value is not FEDFS_OK. Fixes: b82f3ba222b51fe607a0da34a1158425f55bde90 Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- src/libnsdb/fileserver.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)