Currently create_pid_directory() never frees the buffer it allocates,
resulting in some memory leakage.
Index: heartbeat-ipv6addr/resources/OCF/IPv6addr.c
===================================================================
--- heartbeat-ipv6addr.orig/resources/OCF/IPv6addr.c 2007-04-13
15:41:43.000000000 +0900
+++ heartbeat-ipv6addr/resources/OCF/IPv6addr.c 2007-04-13 15:43:17.000000000
+0900
@@ -692,6 +692,7 @@
create_pid_directory(const char *pid_file)
{
int status;
+ int return_status = -1;
struct stat stat_buf;
char* dir;
@@ -709,28 +710,29 @@
if (status < 0 && errno != ENOENT && errno != ENOTDIR) {
cl_log(LOG_INFO, "Could not stat pid-file directory "
"[%s]: %s", dir, strerror(errno));
- free(dir);
- return -1;
+ goto err;
}
if (!status) {
if (S_ISDIR(stat_buf.st_mode)) {
- return 0;
+ goto out;
}
cl_log(LOG_INFO, "Pid-File directory exists but is "
"not a directory [%s]", dir);
- free(dir);
- return -1;
+ goto err;
}
if (mkdir(dir, S_IRUSR|S_IWUSR|S_IXUSR | S_IRGRP|S_IXGRP) < 0) {
cl_log(LOG_INFO, "Could not create pid-file directory "
"[%s]: %s", dir, strerror(errno));
- free(dir);
- return -1;
+ goto err;
}
- return 0;
+out:
+ return_status = 0;
+err:
+ free(dir);
+ return return_status;
}
int
--
--
Horms
H: http://www.vergenet.net/~horms/
W: http://www.valinux.co.jp/en/
_______________________________________________________
Linux-HA-Dev: [EMAIL PROTECTED]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/