summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAndriy Gelman <andriy.gelman@gmail.com>2020-01-30 21:10:37 -0500
committerAlan Antonuk <alan.antonuk@gmail.com>2020-01-31 19:51:38 -0800
commiteffe284fbfd9c88eb05c6b939051bb2f56c001e6 (patch)
treec4a57760d76391083c8a36c851a8d411090ece6f /examples
parent3cde0bb1afa3315227890324dd62d5d6c5376be2 (diff)
downloadrabbitmq-c-effe284fbfd9c88eb05c6b939051bb2f56c001e6.tar.gz
Fix mem leak in examples
Frees heap allocated memory in queuename.bytes on exit.
Diffstat (limited to 'examples')
-rw-r--r--examples/amqp_consumer.c2
-rw-r--r--examples/amqp_listen.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/examples/amqp_consumer.c b/examples/amqp_consumer.c
index 93c7a21..440c25a 100644
--- a/examples/amqp_consumer.c
+++ b/examples/amqp_consumer.c
@@ -205,6 +205,8 @@ int main(int argc, char const *const *argv) {
run(conn);
+ amqp_bytes_free(queuename);
+
die_on_amqp_error(amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS),
"Closing channel");
die_on_amqp_error(amqp_connection_close(conn, AMQP_REPLY_SUCCESS),
diff --git a/examples/amqp_listen.c b/examples/amqp_listen.c
index 9026226..1659cec 100644
--- a/examples/amqp_listen.c
+++ b/examples/amqp_listen.c
@@ -133,6 +133,8 @@ int main(int argc, char const *const *argv) {
}
}
+ amqp_bytes_free(queuename);
+
die_on_amqp_error(amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS),
"Closing channel");
die_on_amqp_error(amqp_connection_close(conn, AMQP_REPLY_SUCCESS),