[BusyBox] [PATCH] tftp getopt and optarg

Magnus Damm damm at opensource.se
Tue Apr 30 04:25:05 UTC 2002


Hi again,

I'm no master when it comes to getopt, but to me it seems 
perfectly legal to store the pointer that optarg provides.

Or?

I've made a patch for tftp which removes the xstrdup().
This will remove one more memory leak.

/ Magnus
-------------- next part --------------
--- busybox-0.60.3-bb_fix/tftp.c	Tue Apr 30 12:13:00 2002
+++ busybox-0.60.3-tftp-xstrdup/tftp.c	Tue Apr 30 12:09:57 2002
@@ -540,10 +540,10 @@
 			break;
 #endif
 		case 'l': 
-			localfile = xstrdup(optarg);
+			localfile = optarg;
 			break;
 		case 'r':
-			remotefile = xstrdup(optarg);
+			remotefile = optarg;
 			break;
 		}
 	}


More information about the busybox mailing list