summaryrefslogtreecommitdiff
path: root/examples/example_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example_utils.c')
-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);
}
}