[BusyBox-cvs] busybox/editors sed.c,1.133,1.134

Glenn McGrath bug1 at busybox.net
Sun Sep 14 01:25:35 UTC 2003


Update of /var/cvs/busybox/editors
In directory winder:/tmp/cvs-serv16352/editors

Modified Files:
	sed.c 
Log Message:
Fix some memory allocation problems


Index: sed.c
===================================================================
RCS file: /var/cvs/busybox/editors/sed.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- sed.c	13 Sep 2003 15:12:22 -0000	1.133
+++ sed.c	14 Sep 2003 01:25:31 -0000	1.134
@@ -1057,7 +1057,11 @@
 						hold_space_size = strlen(hold_space);
 					}
 					hold_space = xrealloc(hold_space, hold_space_size + strlen(pattern_space) + 2);
-					strcat(hold_space, "\n");
+					if (hold_space_size) {
+						strcat(hold_space, "\n");
+					} else {
+						hold_space[0] = '\n';
+					}
 					strcat(hold_space, pattern_space); 
 					break;
 				}
@@ -1103,6 +1107,7 @@
 
 			if (deleted)
 				break;
+
 		}
 
 		/* we will print the line unless we were told to be quiet or if the
@@ -1155,7 +1160,7 @@
 		else {
 			char *str_cmd = strdup(argv[optind]);
 
-			add_cmd_str(strdup(str_cmd));
+			add_cmd_str(strd_cmd);
 			free(str_cmd);
 			optind++;
 		}




More information about the busybox-cvs mailing list