Index: main.c
===================================================================
RCS file: /repository/curl/src/main.c,v
retrieving revision 1.224
diff -u -r1.224 main.c
--- main.c	16 Jan 2004 09:17:04 -0000	1.224
+++ main.c	19 Jan 2004 21:04:12 -0000
@@ -2117,12 +2117,22 @@
           line++;
         *line=0; /* zero terminate */
       }
+
+      if (param && !*param) {
+        /* do this so getparameter can check
+           for required parameters.  Otherwise it always
+           thinks there's a parameter. */
+        if (alloced_param)
+          free(param);
+        param = NULL;
+      }
+
 #ifdef DEBUG_CONFIG
-      fprintf(stderr, "PARAM: \"%s\"\n", param);
+      fprintf(stderr, "PARAM: \"%s\"\n",(param ? param : "(null)"));
 #endif
       res = getparameter(option, param, &usedarg, config);
 
-      if(*param && !usedarg)
+      if (param && *param && !usedarg)
         /* we passed in a parameter that wasn't used! */
         res = PARAM_GOT_EXTRA_PARAMETER;
 
@@ -2139,7 +2149,10 @@
       }
 
       if(alloced_param)
+      {
         free(param);
+	param = NULL;
+      }
 
       free(aline);
     }
@@ -3371,7 +3384,7 @@
   if(config->headerfile && !headerfilep && heads.stream)
     fclose(heads.stream);
 
-  if(config->trace_fopened)
+  if(config->trace_fopened && config->trace_stream)
     fclose(config->trace_stream);
 
   if(allocuseragent)


