summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrijan Sivakumar <ssivakum@redhat.com>2020-09-01 12:48:48 +0530
committerMOHIT AGRAWAL <moagrawa@redhat.com>2020-09-03 02:54:47 +0000
commitebc0253269d8a538239dd0b99d42f56ea320b0f0 (patch)
tree44412129a978a8e9d5863673b726ef3a4be5d2e5
parent718f030b3a30af43a65588d90b8cd0553c9b78cf (diff)
Events: Fixing coverity issues.
Fixing resource leak reported by coverity scan. CID: 1431237 Change-Id: I2bed106b3dc4296c50d80542ee678d32c6928c25 Updates: #1060 Signed-off-by: Srijan Sivakumar <ssivakum@redhat.com>
-rw-r--r--libglusterfs/src/events.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libglusterfs/src/events.c b/libglusterfs/src/events.c
index 6369e8f..3315754 100644
--- a/libglusterfs/src/events.c
+++ b/libglusterfs/src/events.c
@@ -40,6 +40,7 @@ _gf_event(eventtypes_t event, const char *fmt, ...)
char *host = NULL;
struct addrinfo hints;
struct addrinfo *result = NULL;
+ struct addrinfo *iter_result_ptr = NULL;
xlator_t *this = THIS;
char *volfile_server_transport = NULL;
@@ -77,9 +78,10 @@ _gf_event(eventtypes_t event, const char *fmt, ...)
}
// iterate over the result and break when socket creation is success.
- for (; result != NULL; result = result->ai_next) {
- sock = socket(result->ai_family, result->ai_socktype,
- result->ai_protocol);
+ for (iter_result_ptr = result; iter_result_ptr != NULL;
+ iter_result_ptr = iter_result_ptr->ai_next) {
+ sock = socket(iter_result_ptr->ai_family, iter_result_ptr->ai_socktype,
+ iter_result_ptr->ai_protocol);
if (sock != -1) {
break;
}