diff --git a/arch/sparc32/boot.c b/arch/sparc32/boot.c index 1b5c797..dfd15c1 100644 --- a/arch/sparc32/boot.c +++ b/arch/sparc32/boot.c @@ -45,18 +45,18 @@ void boot(void) } else { switch (boot_device) { case 'a': - path = "/obio/SUNW,fdtwo"; + path = strdup("/obio/SUNW,fdtwo"); oldpath = "fd()"; unit = 0; break; case 'c': - path = "disk"; + path = strdup("disk"); oldpath = "sd(0,0,0):d"; unit = 0; break; default: case 'd': - path = "cdrom"; + path = strdup("cdrom"); // FIXME: hardcoding this looks almost definitely wrong. // With sd(0,2,0):b we get to see the solaris kernel though //oldpath = "sd(0,2,0):d"; @@ -64,7 +64,7 @@ void boot(void) unit = 2; break; case 'n': - path = "net"; + path = strdup("net"); oldpath = "le()"; unit = 0; break; diff --git a/drivers/esp.c b/drivers/esp.c index b57567a..f2ab57b 100644 --- a/drivers/esp.c +++ b/drivers/esp.c @@ -279,8 +279,14 @@ ob_sd_open(__attribute__((unused))sd_private_t **sd) *sd = &global_esp->sd[id]; #ifdef CONFIG_DEBUG_ESP - fword("my-args"); - DPRINTF("opening drive %d args %s\n", id, pop_fstr_copy()); + { + char *args; + + fword("my-args"); + args = pop_fstr_copy(); + DPRINTF("opening drive %d args %s\n", id, args); + free(args); + } #endif selfword("open-deblocker"); diff --git a/drivers/obio.c b/drivers/obio.c index 60e3a9f..2c684a0 100644 --- a/drivers/obio.c +++ b/drivers/obio.c @@ -223,10 +223,13 @@ zs_open(unsigned long *address) *address = *prop; fword("my-args"); args = pop_fstr_copy(); - if (args && args[0] == 'a') - *address += 4; + if (args) { + if (args[0] == 'a') + *address += 4; + //printk("zs_open: address %lx, args %s\n", *address, args); + free(args); + } - //printk("zs_open: address %lx, args %s\n", *address, args); RET ( -1 ); } diff --git a/modules/bindings.c b/modules/bindings.c index 7faa267..235e678 100644 --- a/modules/bindings.c +++ b/modules/bindings.c @@ -253,6 +253,8 @@ pop_fstr_copy( void ) if( !len ) return NULL; str = malloc( len + 1 ); + if( !str ) + return NULL; memcpy( str, p, len ); str[len] = 0; return str; diff --git a/modules/video.c b/modules/video.c index e3f63ef..7c3efb5 100644 --- a/modules/video.c +++ b/modules/video.c @@ -253,6 +253,7 @@ video_write(void) addr = pop_fstr_copy(); console_draw_str(addr); + free(addr); PUSH(len); }