From d87a1746479be20f6746518a6e8271cec5969c46 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Javier=20Jard=C3=B3n?= Date: Fri, 27 Jan 2012 18:41:21 +0000 Subject: [PATCH] examples/service-selection.c: Only free variable if success Also print the error message in case there was an error --- examples/service-selection.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/examples/service-selection.c b/examples/service-selection.c index b411e7a..f50d1dc 100644 --- a/examples/service-selection.c +++ b/examples/service-selection.c @@ -24,14 +24,19 @@ int main (int argc, char *argv[]) &subject_alt_name_constraint, &error); - if (success) - g_debug ("Got id: %s %s\n", nai, password); + if (success) { + printf ("Got identity: %s %s %s\n", nai, password, server_certificate_hash); + moonshot_free (nai); + moonshot_free (password); + moonshot_free (server_certificate_hash); + moonshot_free (ca_certificate); + moonshot_free (subject_name_constraint); + moonshot_free (subject_alt_name_constraint); - moonshot_free (nai); - moonshot_free (password); - moonshot_free (server_certificate_hash); - moonshot_free (ca_certificate); - moonshot_free (subject_name_constraint); - moonshot_free (subject_alt_name_constraint); + return 0; + } else { + printf ("Error: %s\n", error->message); + return 1; + } } -- 2.1.4