From 4f30d164910f88f181489f591c0957317142da01 Mon Sep 17 00:00:00 2001 From: David Wragg Date: Tue, 27 Jul 2010 19:36:36 +0100 Subject: Free heap-allocated error strings Even though we are about to exit anyway. --- examples/example_utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples') 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); } } -- cgit v1.2.1