diff options
author | Tony Garnock-Jones <tonyg@kcbbs.gen.nz> | 2009-04-29 23:02:17 +0100 |
---|---|---|
committer | Tony Garnock-Jones <tonyg@kcbbs.gen.nz> | 2009-04-29 23:02:17 +0100 |
commit | 92ec7c66b268b922d28f089125ab76a466cdd657 (patch) | |
tree | 6cade7c7e4c8b27fbf5c1daaebc5fb4f0cafac8f /examples | |
parent | 720be63044d57282e7e5bb5b88195639d654c94f (diff) | |
download | rabbitmq-c-github-ask-92ec7c66b268b922d28f089125ab76a466cdd657.tar.gz |
Be more careful about checking allocation results.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/amqp_listen.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/amqp_listen.c b/examples/amqp_listen.c index b67474d..e33b3ef 100644 --- a/examples/amqp_listen.c +++ b/examples/amqp_listen.c @@ -1,6 +1,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <errno.h> #include <stdint.h> #include <amqp.h> @@ -59,6 +60,9 @@ int main(int argc, char const * const *argv) { "Declaring queue"); amqp_queue_declare_ok_t *r = (amqp_queue_declare_ok_t *) result.reply.decoded; queuename = amqp_bytes_malloc_dup(r->queue); + if (queuename.bytes == NULL) { + die_on_error(-ENOMEM, "Copying queue name"); + } } { |