Skip to content
Snippets Groups Projects
Commit aacd6b65 authored by Tim Wickberg's avatar Tim Wickberg
Browse files

Fix two issues identified by Coverity within the heartbeat code.

parent 6e5f024a
No related branches found
No related tags found
No related merge requests found
...@@ -184,11 +184,12 @@ time_t get_last_heartbeat(void) ...@@ -184,11 +184,12 @@ time_t get_last_heartbeat(void)
* at the moment. Once opened, our handle should persist during * at the moment. Once opened, our handle should persist during
* the shuffle, as the contents are left intact. * the shuffle, as the contents are left intact.
*/ */
for (i = 0; i < OPEN_RETRIES; i++) { for (i = 0; (i < OPEN_RETRIES) && (fd < 0); i++) {
fd = open(file, O_RDONLY); fd = open(file, O_RDONLY);
if (fd < 0) { if (fd < 0) {
error("%s: heartbeat open attempt %d failed from %s.", error("%s: heartbeat open attempt %d failed from %s.",
__func__, i, file); __func__, i, file);
xfree(file);
return 0; return 0;
} }
} }
...@@ -200,6 +201,7 @@ time_t get_last_heartbeat(void) ...@@ -200,6 +201,7 @@ time_t get_last_heartbeat(void)
} }
close(fd); close(fd);
xfree(file);
return (time_t) NTOH_uint64(value); return (time_t) NTOH_uint64(value);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment