summaryrefslogtreecommitdiff
path: root/sql/wsrep_notify.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/wsrep_notify.cc')
-rw-r--r--sql/wsrep_notify.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/wsrep_notify.cc b/sql/wsrep_notify.cc
index fb04d7be7c1..3683d70a980 100644
--- a/sql/wsrep_notify.cc
+++ b/sql/wsrep_notify.cc
@@ -40,11 +40,13 @@ void wsrep_notify_status (wsrep_member_status_t status,
return;
}
- char cmd_buf[1 << 16]; // this can be long
- long cmd_len = sizeof(cmd_buf) - 1;
- char* cmd_ptr = cmd_buf;
+ const long cmd_len = (1 << 16) - 1;
+ char* cmd_ptr = (char*) my_malloc(cmd_len + 1, MYF(MY_WME));
long cmd_off = 0;
+ if (!cmd_ptr)
+ return; // the warning is in the log
+
cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, "%s",
wsrep_notify_cmd);
@@ -93,6 +95,7 @@ void wsrep_notify_status (wsrep_member_status_t status,
{
WSREP_ERROR("Notification buffer too short (%ld). Aborting notification.",
cmd_len);
+ my_free(cmd_ptr);
return;
}
@@ -106,5 +109,6 @@ void wsrep_notify_status (wsrep_member_status_t status,
WSREP_ERROR("Notification command failed: %d (%s): \"%s\"",
err, strerror(err), cmd_ptr);
}
+ my_free(cmd_ptr);
}