summaryrefslogtreecommitdiff
path: root/core/elflink
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-06-17 11:57:29 +0100
committerMatt Fleming <matt.fleming@intel.com>2013-06-17 11:57:29 +0100
commita0bb1928c8652aada30243089c53754ddd9b99df (patch)
tree5fd177bf495f80b51d323a7d7ebf76e8650e65c4 /core/elflink
parent97bff28959e9deed6b78dd7df974797476683006 (diff)
parent022cdd1d56512e8759e8374c10a7420201db93c0 (diff)
downloadsyslinux-a0bb1928c8652aada30243089c53754ddd9b99df.tar.gz
Merge tag 'syslinux-5.11-pre2' into firmware
syslinux-5.11-pre2 Conflicts: core/elflink/load_env32.c version
Diffstat (limited to 'core/elflink')
-rw-r--r--core/elflink/load_env32.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/core/elflink/load_env32.c b/core/elflink/load_env32.c
index 470bd154..492cc095 100644
--- a/core/elflink/load_env32.c
+++ b/core/elflink/load_env32.c
@@ -121,14 +121,11 @@ void load_env32(com32sys_t * regs __unused)
dprintf("Starting %s elf module subsystem...\n", ELF_MOD_SYS);
- PATH = malloc(strlen(CurrentDirName) + 1);
- if (!PATH) {
+ if (strlen(CurrentDirName) && !path_add(CurrentDirName)) {
printf("Couldn't allocate memory for PATH\n");
goto out;
}
- strcpy(PATH, CurrentDirName);
-
size = (size_t)__dynstr_end - (size_t)__dynstr_start;
core_module.strtable_size = size;
size = (size_t)__dynsym_end - (size_t)__dynsym_start;
@@ -162,30 +159,15 @@ void load_env32(com32sys_t * regs __unused)
if (!core_getcwd(path, sizeof(path)))
goto out;
- if (!strlen(PATH)) {
- PATH = realloc(PATH, strlen(path) + 1);
- if (!PATH) {
- printf("Couldn't allocate memory for PATH\n");
- goto out;
- }
-
- strcpy(PATH, path);
- } else {
- PATH = realloc(PATH, strlen(path) + strlen(PATH) + 2);
- if (!PATH) {
- printf("Couldn't allocate memory for PATH\n");
- goto out;
- }
-
- strcat(PATH, ":");
- strcat(PATH, path);
+ if (!path_add(path)) {
+ printf("Couldn't allocate memory for PATH\n");
+ goto out;
}
start_ldlinux(1, argv);
}
out:
- free(PATH);
writestr("\nFailed to load ");
writestr(LDLINUX);
}