[BusyBox] [PATCH] - updates malloc to xmalloc in vi.c

Steve Merrifield steve at labyrinth.net.au
Tue Nov 13 04:24:46 UTC 2001


"Vladimir N. Oleynik" wrote:
> 
> Hi, Steve.
> 
> I think,
> 1) require add to vi_main atexit(cookmode); for set old terminal mode after
> "No enought memory"
> 2) convert malloc+memset to xcalloc:  text=, last_modifying_cmd=, t=

> 3) You losed 2 call malloc: status_buffer= and screen=

Umm... It looks like they are there to me:
(This was diffed against the latest CVS code).

@@ -324,7 +324,7 @@
 #ifdef CONFIG_FEATURE_VI_CRASHME
        (void) srand((long) getpid());
 #endif                                  
-       status_buffer = (Byte *) malloc(200);   // hold messages to user
+       status_buffer = (Byte *) xmalloc(200);  // hold messages to user
 #ifdef CONFIG_FEATURE_VI_READONLY
        vi_readonly = readonly = FALSE;
        if (strncmp(argv[0], "view", 4) == 0) {
@@ -2492,7 +2492,7 @@
        if (screen != 0)
                free(screen);
        screensize = ro * co + 8;
-       screen = (Byte *) malloc(screensize);
+       screen = (Byte *) xmalloc(screensize);



steve





More information about the busybox mailing list