Cleanup (prevent repeated use of -p/-oMr to avoid mem leak)
[exim.git] / src / src / exim.c
index 2237476d7018795b5405872b3f7495dd370d61c0..394bf84f09737cb8558cc2973c0cf4f6f297d237 100644 (file)
@@ -2294,7 +2294,7 @@ for (i = 1; i < argc; i++)
       #ifdef ALT_CONFIG_PREFIX
       int sep = 0;
       int len = Ustrlen(ALT_CONFIG_PREFIX);
-      uschar *list = argrest;
+      const uschar *list = argrest;
       uschar *filename;
       while((filename = string_nextinlist(&list, &sep, big_buffer,
              big_buffer_size)) != NULL)
@@ -3092,7 +3092,14 @@ for (i = 1; i < argc; i++)
 
       /* -oMr: Received protocol */
 
-      else if (Ustrcmp(argrest, "Mr") == 0) received_protocol = argv[++i];
+      else if (Ustrcmp(argrest, "Mr") == 0)
+
+        if (received_protocol)
+          {
+          fprintf(stderr, "received_protocol is set already\n");
+          exit(EXIT_FAILURE);
+          }
+        else received_protocol = argv[++i];
 
       /* -oMs: Set sender host name */
 
@@ -3188,7 +3195,15 @@ for (i = 1; i < argc; i++)
 
     if (*argrest != 0)
       {
-      uschar *hn = Ustrchr(argrest, ':');
+      uschar *hn;
+
+      if (received_protocol)
+        {
+        fprintf(stderr, "received_protocol is set already\n");
+        exit(EXIT_FAILURE);
+        }
+
+      hn = Ustrchr(argrest, ':');
       if (hn == NULL)
         {
         received_protocol = argrest;
@@ -5791,7 +5806,9 @@ moreloop:
   deliver_domain_orig = NULL;
   deliver_host = deliver_host_address = NULL;
   dnslist_domain = dnslist_matched = NULL;
+#ifdef WITH_CONTENT_SCAN
   malware_name = NULL;
+#endif
   callout_address = NULL;
   sending_ip_address = NULL;
   acl_var_m = NULL;