summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDavid Wragg <david@rabbitmq.com>2010-07-27 19:36:36 +0100
committerDavid Wragg <david@rabbitmq.com>2010-07-27 19:36:36 +0100
commit4f30d164910f88f181489f591c0957317142da01 (patch)
tree2efeabc9c912f7471c0a0cf95d06a5544c7ac1a0 /examples
parenta39a656ffb1a72b031aa586a37ff77b39939b6fb (diff)
downloadrabbitmq-c-github-ask-4f30d164910f88f181489f591c0957317142da01.tar.gz
Free heap-allocated error strings
Even though we are about to exit anyway.
Diffstat (limited to 'examples')
-rw-r--r--examples/example_utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/example_utils.c b/examples/example_utils.c
index ae8f093..48f21f9 100644
--- a/examples/example_utils.c
+++ b/examples/example_utils.c
@@ -61,7 +61,9 @@
void die_on_error(int x, char const *context) {
if (x < 0) {
- fprintf(stderr, "%s: %s\n", context, amqp_error_string(-x));
+ char *errstr = amqp_error_string(-x);
+ fprintf(stderr, "%s: %s\n", context, errstr);
+ free(errstr);
exit(1);
}
}