[mod_gnutls-devel] msv_ctxt_init() cleanup

Ramkumar Chinchani ramkumar.chinchani at gmail.com
Tue Mar 18 22:09:41 CET 2014


Test code cleanup after recent code changes.

diff --git a/checkmsva.c b/checkmsva.c
index 1c64977..aaa3133 100644
--- a/checkmsva.c
+++ b/checkmsva.c
@@ -17,6 +17,7 @@

 #include <stdlib.h>
 #include <stdio.h>
+#include <signal.h>

 #include "msv/msv.h"

@@ -29,6 +30,12 @@ main (int argc, char **argv)
   struct msv_response *response;

   ctx = msv_ctxt_init (NULL);
+  if (!ctx) {
+      printf ("Unable to initialize context\n"
+              "Make sure MONKEYSPHERE_VALIDATION_AGENT_SOCKET env variable
is set and\n"
+              "the MSVA validation agent is running\n");
+      exit (1);
+  }

   x = msv_check_msva (ctx);
   printf ("MSVA check: %s\n", msv_strerror (ctx, x));
@@ -66,6 +73,10 @@ main (int argc, char **argv)
     "xHMcOGjzfj0LUSqVEVe/D8VzeTEQiNs1MVuRtpQ/dciEL2dkXqjzZiuuhs6TIvDG\n"
     "6wknKthAJdFSXGQkb7kGiw==\n" "-----END CERTIFICATE-----\n";
   x = msv_query_agent (ctx, query, &response);
+  if (!response) {
+      printf ("MSV query: failure contacting MSV agent\n");
+      exit (2);
+  }
   printf ("MSV query: %s\nValid: %s\nMessage: %s\n", msv_strerror (ctx, x),
          response->valid ? "true" : "false", response->message);




On Thu, Mar 13, 2014 at 6:23 PM, Clint Adams <clint at debian.org> wrote:

> On Thu, Mar 13, 2014 at 02:01:00PM -0700, Ramkumar Chinchani wrote:
> > Also noticed that msv.c has a few more malloc's and strdup's without
> proper
> > out-of-memory handling.
>
> Thanks, pushed with whitespace changes.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20140318/c524a926/attachment-0001.html>


More information about the mod_gnutls-devel mailing list