More W32 resolver workarounds
[oweals/gnunet.git] / src / dns / gnunet-dns-redirector.c
index 5ba7e87c6f3c512e0ea6a3553265aafaf0f4320a..4d1a452a55fa84754c1b23ee1314358548cbbea1 100644 (file)
@@ -67,13 +67,13 @@ modify_record (const struct GNUNET_DNSPARSER_Record *record)
 
   switch (record->type)
   {
-  case GNUNET_DNSPARSER_TYPE_A:    
+  case GNUNET_DNSPARSER_TYPE_A:
     if (record->data.raw.data_len != sizeof (struct in_addr))
       return;
     if (NULL != n4)
     {
       if (verbosity > 1)
-       fprintf (stderr, 
+       fprintf (stderr,
                 "Changing A record from `%s' to `%s'\n",
                 inet_ntop (AF_INET, record->data.raw.data, buf, sizeof (buf)),
                 n4);
@@ -86,7 +86,7 @@ modify_record (const struct GNUNET_DNSPARSER_Record *record)
     if (NULL != n6)
     {
       if (verbosity > 1)
-       fprintf (stderr, 
+       fprintf (stderr,
                 "Changing AAAA record from `%s' to `%s'\n",
                 inet_ntop (AF_INET6, record->data.raw.data, buf, sizeof (buf)),
                 n6);
@@ -129,7 +129,7 @@ modify_record (const struct GNUNET_DNSPARSER_Record *record)
  * @param request_length number of bytes in request
  * @param request udp payload of the DNS request
  */
-static void 
+static void
 modify_request (void *cls,
                struct GNUNET_DNS_RequestHandle *rh,
                size_t request_length,
@@ -156,7 +156,7 @@ modify_request (void *cls,
   if (GNUNET_OK != ret)
   {
     if (GNUNET_NO == ret)
-      fprintf (stderr, 
+      fprintf (stderr,
               "Modified DNS response did not fit, keeping old response\n");
     else
       GNUNET_break (0); /* our modifications should have been sane! */
@@ -169,7 +169,7 @@ modify_request (void *cls,
               "Injecting modified DNS response\n");
     GNUNET_DNS_request_answer (rh, len, buf);
   }
-  GNUNET_free_non_null (buf);      
+  GNUNET_free_non_null (buf);
 }
 
 
@@ -219,7 +219,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   }
 
   handle =
-    GNUNET_DNS_connect (cfg, 
+    GNUNET_DNS_connect (cfg,
                        GNUNET_DNS_FLAG_POST_RESOLUTION,
                        &modify_request,
                        NULL);
@@ -245,11 +245,13 @@ main (int argc, char *const *argv)
   if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
     return 2;
 
-  return (GNUNET_OK ==
-          GNUNET_PROGRAM_run (argc, argv, "gnunet-dns-redirector",
-                              gettext_noop
-                              ("Change DNS replies to point elsewhere."), options,
-                              &run, NULL)) ? ret : 1;
+  ret = (GNUNET_OK ==
+        GNUNET_PROGRAM_run (argc, argv, "gnunet-dns-redirector",
+                            gettext_noop
+                            ("Change DNS replies to point elsewhere."), options,
+                            &run, NULL)) ? ret : 1;
+  GNUNET_free ((void*) argv);
+  return ret;
 }