43 lines
1.2 KiB
Diff
43 lines
1.2 KiB
Diff
From 2291784782340796e5c66dcf4f95f75b48a9956d Mon Sep 17 00:00:00 2001
|
|
From: huyan <hu.huyan@huawei.com>
|
|
Date: Mon, 17 Jun 2019 11:48:35 +0800
|
|
Subject: [PATCH] backport remove resource leaks from junction/path.c
|
|
|
|
---
|
|
support/junction/path.c | 6 +++++-
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
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;
|
|
}
|
|
--
|
|
1.8.3.1
|
|
|