* Pretend like we actually manage memory properly by calling free() on
things which were malloc()'ed or strdup()'ed.
(Patch from Dustin Kirkland).
git-archimport-id: erbenson@alaska.net--public/yaboot--devel--1.3--patch-84
-./0arch-timestamps0 1120448537 1120953071
+./0arch-timestamps0 1120953079 1122611350
./BUGS 1109049412 1000991730
./COPYING 1109049412 1000991730
./BUGS 1109049412 1000991730
./COPYING 1109049412 1000991730
-./ChangeLog 1120952850 1120953067
+./ChangeLog 1122611216 1122611345
./Config 1109049412 1002101497
./INSTALL 1109049412 1000991730
./Makefile 1109049412 1089576723
./Config 1109049412 1002101497
./INSTALL 1109049412 1000991730
./Makefile 1109049412 1089576723
./doc/examples/simpleboot.chrp 1109049412 1068017750
./doc/examples/yaboot.conf.multi-boot 1109049412 1006348765
./doc/examples/yaboot.conf.rs6000 1109049412 1006348765
./doc/examples/simpleboot.chrp 1109049412 1068017750
./doc/examples/yaboot.conf.multi-boot 1109049412 1006348765
./doc/examples/yaboot.conf.rs6000 1109049412 1006348765
-./doc/examples 1120953070 1068017750
+./doc/examples 1122611349 1068017750
./doc/yaboot-howto.de.sgml 1109049413 1096186109
./doc/yaboot-howto.sgml 1109049413 1096186082
./doc/yaboot-howto.de.sgml 1109049413 1096186109
./doc/yaboot-howto.sgml 1109049413 1096186082
-./doc 1120953070 1096186109
+./doc 1122611349 1096186109
./etc/yaboot.conf 1109049413 1006348765
./etc/yaboot.conf 1109049413 1006348765
-./etc 1120953070 1007269243
+./etc 1122611349 1007269243
./first/ofboot 1118285749 1065311880
./first/ofboot 1118285749 1065311880
-./first 1120953070 1071492158
+./first 1122611349 1071492158
./include/asm/elf.h 1109049413 1000991730
./include/asm/ppc_asm.tmpl 1109049413 1000991730
./include/asm/processor.h 1109049413 1000991730
./include/asm/elf.h 1109049413 1000991730
./include/asm/ppc_asm.tmpl 1109049413 1000991730
./include/asm/processor.h 1109049413 1000991730
-./include/asm 1120953071 1007269243
+./include/asm 1122611349 1007269243
./include/bootinfo.h 1109049413 1007200690
./include/byteorder.h 1109049413 1000991730
./include/cfg.h 1109049413 1007200690
./include/bootinfo.h 1109049413 1007200690
./include/byteorder.h 1109049413 1000991730
./include/cfg.h 1109049413 1007200690
./include/debug.h 1109049413 1007200690
./include/errors.h 1109049413 1007200690
./include/et/com_err.h 1109049413 1000991731
./include/debug.h 1109049413 1007200690
./include/errors.h 1109049413 1007200690
./include/et/com_err.h 1109049413 1000991731
-./include/et 1120953071 1007269243
+./include/et 1122611349 1007269243
./include/ext2fs/bitops.h 1109049413 1003927524
./include/ext2fs/ext2_err.h 1109049413 1003927524
./include/ext2fs/ext2_io.h 1109049413 1003927524
./include/ext2fs/ext2fs.h 1109049413 1003927524
./include/ext2fs/bitops.h 1109049413 1003927524
./include/ext2fs/ext2_err.h 1109049413 1003927524
./include/ext2fs/ext2_io.h 1109049413 1003927524
./include/ext2fs/ext2fs.h 1109049413 1003927524
-./include/ext2fs 1120953071 1007269243
+./include/ext2fs 1122611350 1007269243
./include/file.h 1109049413 1007200690
./include/fs.h 1109049413 1007200690
./include/linux/elf.h 1109049413 1000991731
./include/file.h 1109049413 1007200690
./include/fs.h 1109049413 1007200690
./include/linux/elf.h 1109049413 1000991731
./include/linux/iso_fs.h 1109049413 1000991731
./include/linux/stat.h 1109049413 1000991731
./include/linux/types.h 1109049413 1000991731
./include/linux/iso_fs.h 1109049413 1000991731
./include/linux/stat.h 1109049413 1000991731
./include/linux/types.h 1109049413 1000991731
-./include/linux 1120953071 1007269243
+./include/linux 1122611350 1007269243
./include/mac-part.h 1109049413 1007200690
./include/md5.h 1109049413 1000991730
./include/prom.h 1109049413 1007200690
./include/reiserfs/reiserfs.h 1109049413 1025684115
./include/mac-part.h 1109049413 1007200690
./include/md5.h 1109049413 1000991730
./include/prom.h 1109049413 1007200690
./include/reiserfs/reiserfs.h 1109049413 1025684115
-./include/reiserfs 1120953071 1025684115
+./include/reiserfs 1122611350 1025684115
./include/setjm2.h 1109049413 1000991730
./include/setjmp.h 1109049413 1000991730
./include/stdlib.h 1109049413 1000991730
./include/setjm2.h 1109049413 1000991730
./include/setjmp.h 1109049413 1000991730
./include/stdlib.h 1109049413 1000991730
./include/swab.h 1109049413 1000991730
./include/types.h 1109049413 1000991730
./include/xfs/xfs.h 1109049413 1002101334
./include/swab.h 1109049413 1000991730
./include/types.h 1109049413 1000991730
./include/xfs/xfs.h 1109049413 1002101334
-./include/xfs 1120953071 1007269244
+./include/xfs 1122611350 1007269244
./include/yaboot.h 1109049413 1007200690
./include/amiga-part.h 1116558586 1116558522
./include/yaboot.h 1109049413 1007200690
./include/amiga-part.h 1116558586 1116558522
-./include/fdisk-part.h 1120952841 1120952841
-./include/partition.h 1120952841 1120952841
-./include 1120953071 1120952841
+./include/fdisk-part.h 1120953080 1120952841
+./include/partition.h 1120953080 1120952841
+./include 1122611349 1120952841
./lib/ctype.c 1109049413 1000991731
./lib/libext2fs.a 1109049413 1003927524
./lib/ctype.c 1109049413 1000991731
./lib/libext2fs.a 1109049413 1003927524
-./lib/malloc.c 1109049413 1007200690
+./lib/malloc.c 1122610545 1007200690
./lib/nosys.c 1109049413 1000991731
./lib/string.S 1109049413 1007200690
./lib/strtol.c 1109049413 1000991731
./lib/vsprintf.c 1109049413 1000991731
./lib/strstr.c 1119929028 1116476589
./lib/nosys.c 1109049413 1000991731
./lib/string.S 1109049413 1007200690
./lib/strtol.c 1109049413 1000991731
./lib/vsprintf.c 1109049413 1000991731
./lib/strstr.c 1119929028 1116476589
-./lib 1120953071 1116476589
+./lib 1122610543 1116476589
./man/bootstrap.8 1116558691 1000991731
./man/mkofboot.8 1116558691 1006348765
./man/ofpath.8 1116558691 1000991731
./man/yaboot.conf.5 1116558691 1004256691
./man/yabootconfig.8 1116558691 1027929577
./man/ybin.8 1116558691 1006348765
./man/bootstrap.8 1116558691 1000991731
./man/mkofboot.8 1116558691 1006348765
./man/ofpath.8 1116558691 1000991731
./man/yaboot.conf.5 1116558691 1004256691
./man/yabootconfig.8 1116558691 1027929577
./man/ybin.8 1116558691 1006348765
-./man/yaboot.8 1116558691 1090699543
-./man 1120953071 1116476667
+./man/yaboot.8 1121662318 1090699543
+./man 1122611350 1116476667
./man.patch 1116558699 1006348761
./second/cache.S 1120952570 1007200690
./second/cfg.c 1120952570 1007200690
./second/cmdline.c 1120952570 1032059589
./second/crt0.S 1120952570 1000991731
./man.patch 1116558699 1006348761
./second/cache.S 1120952570 1007200690
./second/cfg.c 1120952570 1007200690
./second/cmdline.c 1120952570 1032059589
./second/crt0.S 1120952570 1000991731
-./second/file.c 1120952570 1044868693
./second/fs.c 1120952570 1032059574
./second/fs_ext2.c 1120952570 1032059564
./second/fs_iso.c 1120952570 1007200690
./second/fs.c 1120952570 1032059574
./second/fs_ext2.c 1120952570 1032059564
./second/fs_iso.c 1120952570 1007200690
./second/md5.c 1120952570 1032059532
./second/prom.c 1120952570 1067937197
./second/setjmp.S 1120952570 1000991732
./second/md5.c 1120952570 1032059532
./second/prom.c 1120952570 1067937197
./second/setjmp.S 1120952570 1000991732
-./second/yaboot.c 1120952570 1032059504
-./second/fs_of.c 1120952841 1120952841
-./second/partition.c 1120952841 1120952841
-./second 1120953071 1120952841
+./second/fs_of.c 1120953080 1120952841
+./second/file.c 1122611207 1122611207
+./second/partition.c 1122611207 1122611207
+./second/yaboot.c 1122611207 1122611207
+./second 1122611350 1122611207
./util/elfextract.c 1109049413 1007303237
./util/addnote.c 1109049413 1107321884
./util/elfextract.c 1109049413 1007303237
./util/addnote.c 1109049413 1107321884
-./util 1120953071 1107321884
-./ybin/mkofboot 1120953071 1073219938
+./util 1122611350 1107321884
+./ybin/mkofboot 1122611350 1073219938
./ybin/ofpath 1120448537 1120448442
./ybin/yabootconfig 1117166139 1089576743
./ybin/ybin 1120448039 1120447943
./ybin/ofpath 1120448537 1120448442
./ybin/yabootconfig 1117166139 1089576743
./ybin/ybin 1120448039 1120447943
-./ybin 1120953071 1120448442
-. 1120953070 1120953067
+./ybin 1122611350 1120448442
+. 1122611349 1122611345
# arch-tag: automatic-ChangeLog--erbenson@alaska.net--public/yaboot--devel--1.3
#
# arch-tag: automatic-ChangeLog--erbenson@alaska.net--public/yaboot--devel--1.3
#
+2005-07-29 04:29:18 GMT Ethan Benson <erbenson@alaska.net> patch-84
+
+ Summary:
+ Pretend to allocate/deallocate memory correctly
+ Revision:
+ yaboot--devel--1.3--patch-84
+
+ * Pretend like we actually manage memory properly by calling free() on
+ things which were malloc()'ed or strdup()'ed.
+ (Patch from Dustin Kirkland).
+
+ modified files:
+ 0arch-timestamps0 ChangeLog second/file.c second/partition.c
+ second/yaboot.c
+
+
2005-07-09 23:51:20 GMT Ethan Benson <erbenson@alaska.net> patch-83
Summary:
2005-07-09 23:51:20 GMT Ethan Benson <erbenson@alaska.net> patch-83
Summary:
if (!imagepath)
return 0;
if (!imagepath)
return 0;
- else
- ipath = strdup(imagepath);
+ else if (!(ipath = strdup(imagepath)))
+ return 0;
if (defdevice)
defdev = strdup(defdevice);
if (defdevice)
defdev = strdup(defdevice);
if ((ptr = strrchr(defdev, ':')) != NULL)
*ptr = 0; /* remove trailing : from defdevice if necessary */
}
if ((ptr = strrchr(defdev, ':')) != NULL)
*ptr = 0; /* remove trailing : from defdevice if necessary */
}
}
/* if there is no : then there is no filename or partition. must
}
/* if there is no : then there is no filename or partition. must
} else if (strlen(ipath)) {
result->file = strdup(ipath);
} else {
} else if (strlen(ipath)) {
result->file = strdup(ipath);
} else {
possible = amiga_block[AMIGA_RDBLIMIT]/32 +1;
used = (unsigned int *) malloc (sizeof (unsigned int) * (possible + 1));
possible = amiga_block[AMIGA_RDBLIMIT]/32 +1;
used = (unsigned int *) malloc (sizeof (unsigned int) * (possible + 1));
+ if (!used) {
+ prom_printf("Can't allocate memory\n");
+ return;
+ }
for (i=0; i < possible; i++) used[i] = 0;
for (i=0; i < possible; i++) used[i] = 0;
+ if (used)
+ free(used);
if (opened)
file.fs->close(&file);
if (opened)
file.fs->close(&file);
- if (result != 1 && conf_file)
free(conf_file);
return result;
free(conf_file);
return result;
/* Read the rest of the Elf header... */
if ((*(file->fs->read))(file, size, &e->e_version) < size) {
prom_printf("\nCan't read Elf32 image header\n");
/* Read the rest of the Elf header... */
if ((*(file->fs->read))(file, size, &e->e_version) < size) {
prom_printf("\nCan't read Elf32 image header\n");
}
DEBUG_F("Elf32 header:\n");
}
DEBUG_F("Elf32 header:\n");
if (e->e_phnum > MAX_HEADERS) {
prom_printf ("Can only load kernels with one program header\n");
if (e->e_phnum > MAX_HEADERS) {
prom_printf ("Can only load kernels with one program header\n");
}
ph = (Elf32_Phdr *)malloc(sizeof(Elf32_Phdr) * e->e_phnum);
if (!ph) {
prom_printf ("Malloc error\n");
}
ph = (Elf32_Phdr *)malloc(sizeof(Elf32_Phdr) * e->e_phnum);
if (!ph) {
prom_printf ("Malloc error\n");
}
/* Now, we read the section header */
if ((*(file->fs->seek))(file, e->e_phoff) != FILE_ERR_OK) {
prom_printf ("seek error\n");
}
/* Now, we read the section header */
if ((*(file->fs->seek))(file, e->e_phoff) != FILE_ERR_OK) {
prom_printf ("seek error\n");
}
if ((*(file->fs->read))(file, sizeof(Elf32_Phdr) * e->e_phnum, ph) !=
sizeof(Elf32_Phdr) * e->e_phnum) {
prom_printf ("read error\n");
}
if ((*(file->fs->read))(file, sizeof(Elf32_Phdr) * e->e_phnum, ph) !=
sizeof(Elf32_Phdr) * e->e_phnum) {
prom_printf ("read error\n");
}
/* Scan through the program header
}
/* Scan through the program header
if (loadinfo->memsize == 0) {
prom_printf("Can't find a loadable segment !\n");
if (loadinfo->memsize == 0) {
prom_printf("Can't find a loadable segment !\n");
}
/* leave some room (1Mb) for boot infos */
}
/* leave some room (1Mb) for boot infos */
}
if (loadinfo->base == (void *)-1) {
prom_printf("Claim error, can't allocate kernel memory\n");
}
if (loadinfo->base == (void *)-1) {
prom_printf("Claim error, can't allocate kernel memory\n");
}
DEBUG_F("After ELF parsing, load base: %p, mem_sz: 0x%08lx\n",
}
DEBUG_F("After ELF parsing, load base: %p, mem_sz: 0x%08lx\n",
if ((*(file->fs->seek))(file, p->p_offset) != FILE_ERR_OK) {
prom_printf ("Seek error\n");
prom_release(loadinfo->base, loadinfo->memsize);
if ((*(file->fs->seek))(file, p->p_offset) != FILE_ERR_OK) {
prom_printf ("Seek error\n");
prom_release(loadinfo->base, loadinfo->memsize);
}
offset = p->p_vaddr - loadinfo->load_loc;
if ((*(file->fs->read))(file, p->p_filesz, loadinfo->base+offset) != p->p_filesz) {
prom_printf ("Read failed\n");
prom_release(loadinfo->base, loadinfo->memsize);
}
offset = p->p_vaddr - loadinfo->load_loc;
if ((*(file->fs->read))(file, p->p_filesz, loadinfo->base+offset) != p->p_filesz) {
prom_printf ("Read failed\n");
prom_release(loadinfo->base, loadinfo->memsize);
/* Return success at loading the Elf32 kernel */
return 1;
/* Return success at loading the Elf32 kernel */
return 1;
+
+bail:
+ if (ph)
+ free(ph);
+ return 0;
/* Read the rest of the Elf header... */
if ((*(file->fs->read))(file, size, &e->e_version) < size) {
prom_printf("\nCan't read Elf64 image header\n");
/* Read the rest of the Elf header... */
if ((*(file->fs->read))(file, size, &e->e_version) < size) {
prom_printf("\nCan't read Elf64 image header\n");
}
DEBUG_F("Elf64 header:\n");
}
DEBUG_F("Elf64 header:\n");
if (e->e_phnum > MAX_HEADERS) {
prom_printf ("Can only load kernels with one program header\n");
if (e->e_phnum > MAX_HEADERS) {
prom_printf ("Can only load kernels with one program header\n");
}
ph = (Elf64_Phdr *)malloc(sizeof(Elf64_Phdr) * e->e_phnum);
if (!ph) {
prom_printf ("Malloc error\n");
}
ph = (Elf64_Phdr *)malloc(sizeof(Elf64_Phdr) * e->e_phnum);
if (!ph) {
prom_printf ("Malloc error\n");
}
/* Now, we read the section header */
if ((*(file->fs->seek))(file, e->e_phoff) != FILE_ERR_OK) {
prom_printf ("Seek error\n");
}
/* Now, we read the section header */
if ((*(file->fs->seek))(file, e->e_phoff) != FILE_ERR_OK) {
prom_printf ("Seek error\n");
}
if ((*(file->fs->read))(file, sizeof(Elf64_Phdr) * e->e_phnum, ph) !=
sizeof(Elf64_Phdr) * e->e_phnum) {
prom_printf ("Read error\n");
}
if ((*(file->fs->read))(file, sizeof(Elf64_Phdr) * e->e_phnum, ph) !=
sizeof(Elf64_Phdr) * e->e_phnum) {
prom_printf ("Read error\n");
}
/* Scan through the program header
}
/* Scan through the program header
if (loadinfo->memsize == 0) {
prom_printf("Can't find a loadable segment !\n");
if (loadinfo->memsize == 0) {
prom_printf("Can't find a loadable segment !\n");
}
/* leave some room (1Mb) for boot infos */
}
/* leave some room (1Mb) for boot infos */
}
if (loadinfo->base == (void *)-1) {
prom_printf("Claim error, can't allocate kernel memory\n");
}
if (loadinfo->base == (void *)-1) {
prom_printf("Claim error, can't allocate kernel memory\n");
}
DEBUG_F("After ELF parsing, load base: %p, mem_sz: 0x%08lx\n",
}
DEBUG_F("After ELF parsing, load base: %p, mem_sz: 0x%08lx\n",
if ((*(file->fs->seek))(file, p->p_offset) != FILE_ERR_OK) {
prom_printf ("Seek error\n");
prom_release(loadinfo->base, loadinfo->memsize);
if ((*(file->fs->seek))(file, p->p_offset) != FILE_ERR_OK) {
prom_printf ("Seek error\n");
prom_release(loadinfo->base, loadinfo->memsize);
}
offset = p->p_vaddr - loadinfo->load_loc;
if ((*(file->fs->read))(file, p->p_filesz, loadinfo->base+offset) != p->p_filesz) {
prom_printf ("Read failed\n");
prom_release(loadinfo->base, loadinfo->memsize);
}
offset = p->p_vaddr - loadinfo->load_loc;
if ((*(file->fs->read))(file, p->p_filesz, loadinfo->base+offset) != p->p_filesz) {
prom_printf ("Read failed\n");
prom_release(loadinfo->base, loadinfo->memsize);
/* Return success at loading the Elf64 kernel */
return 1;
/* Return success at loading the Elf64 kernel */
return 1;
+
+bail:
+ if (ph)
+ free(ph);
+ return 0;
if ((ptype != NULL) && (strcmp(ptype, "Apple_Bootstrap")))
prom_printf("\nWARNING: Bootstrap partition type is wrong: \"%s\"\n"
" type should be: \"Apple_Bootstrap\"\n\n", ptype);
if ((ptype != NULL) && (strcmp(ptype, "Apple_Bootstrap")))
prom_printf("\nWARNING: Bootstrap partition type is wrong: \"%s\"\n"
" type should be: \"Apple_Bootstrap\"\n\n", ptype);
+ if (ptype)
+ free(ptype);
prom_printf("Bye.\n");
return 0;
}
prom_printf("Bye.\n");
return 0;
}