summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2019-04-28 13:24:24 -0400
committerSteve Dickson <steved@redhat.com>2019-04-28 13:24:24 -0400
commit6cdc29f6e2bb33637ee8e184449cb0482719e083 (patch)
tree165ad9b5c6e02c4bb7612778e59c97bf31344892
parent353eff80e8f9321a18131db0b703abe6fff41387 (diff)
downloadnfs-utils-6cdc29f6e2bb33637ee8e184449cb0482719e083.tar.gz
Removed resource leaks from junction/path.c
junction/path.c:167: leaked_storage: Variable "start" going out of scope leaks the storage it points to. junction/path.c:331: leaked_storage: Variable "normalized" going out of scope leaks the storage it points to. junction/path.c:340: leaked_storage: Variable "normalized" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--support/junction/path.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/support/junction/path.c b/support/junction/path.c
index e74e4c4..13a1438 100644
--- a/support/junction/path.c
+++ b/support/junction/path.c
@@ -163,8 +163,10 @@ nsdb_count_components(const char *pathname, size_t *len,
break;
next = strchrnul(component, '/');
tmp = (size_t)(next - component);
- if (tmp > 255)
+ if (tmp > 255) {
+ free(start);
return false;
+ }
length += XDR_UINT_BYTES + (nsdb_quadlen(tmp) << 2);
count++;
@@ -328,11 +330,13 @@ nsdb_posix_to_path_array(const char *pathname, char ***path_array)
length = (size_t)(next - component);
if (length > 255) {
nsdb_free_string_array(result);
+ free(normalized);
return FEDFS_ERR_SVRFAULT;
}
result[i] = strndup(component, length);
if (result[i] == NULL) {
+ free(normalized);
nsdb_free_string_array(result);
return FEDFS_ERR_SVRFAULT;
}