j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: blueswirl Date: 2007-06-27 22:16:01 +0200 (Wed, 27 Jun 2007) New Revision: 155
Modified: openbios-devel/arch/sparc32/boot.c openbios-devel/drivers/esp.c openbios-devel/drivers/obio.c openbios-devel/modules/bindings.c openbios-devel/modules/video.c Log: Fix pop_fstr_copy memory leaks - console one prevented Debian 3.1r1 from installing in console=prom mode - fixing this also needed the real malloc/free
Modified: openbios-devel/arch/sparc32/boot.c =================================================================== --- openbios-devel/arch/sparc32/boot.c 2007-06-27 20:11:08 UTC (rev 154) +++ openbios-devel/arch/sparc32/boot.c 2007-06-27 20:16:01 UTC (rev 155) @@ -45,18 +45,18 @@ } 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 @@ unit = 2; break; case 'n': - path = "net"; + path = strdup("net"); oldpath = "le()"; unit = 0; break;
Modified: openbios-devel/drivers/esp.c =================================================================== --- openbios-devel/drivers/esp.c 2007-06-27 20:11:08 UTC (rev 154) +++ openbios-devel/drivers/esp.c 2007-06-27 20:16:01 UTC (rev 155) @@ -279,8 +279,14 @@ *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");
Modified: openbios-devel/drivers/obio.c =================================================================== --- openbios-devel/drivers/obio.c 2007-06-27 20:11:08 UTC (rev 154) +++ openbios-devel/drivers/obio.c 2007-06-27 20:16:01 UTC (rev 155) @@ -223,10 +223,13 @@ *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 ); }
Modified: openbios-devel/modules/bindings.c =================================================================== --- openbios-devel/modules/bindings.c 2007-06-27 20:11:08 UTC (rev 154) +++ openbios-devel/modules/bindings.c 2007-06-27 20:16:01 UTC (rev 155) @@ -253,6 +253,8 @@ if( !len ) return NULL; str = malloc( len + 1 ); + if( !str ) + return NULL; memcpy( str, p, len ); str[len] = 0; return str;
Modified: openbios-devel/modules/video.c =================================================================== --- openbios-devel/modules/video.c 2007-06-27 20:11:08 UTC (rev 154) +++ openbios-devel/modules/video.c 2007-06-27 20:16:01 UTC (rev 155) @@ -253,6 +253,7 @@ addr = pop_fstr_copy();
console_draw_str(addr); + free(addr); PUSH(len); }