summaryrefslogtreecommitdiffstats
path: root/utils/imxtools
diff options
context:
space:
mode:
Diffstat (limited to 'utils/imxtools')
-rw-r--r--utils/imxtools/sbtools/elf.c5
-rw-r--r--utils/imxtools/sbtools/misc.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/utils/imxtools/sbtools/elf.c b/utils/imxtools/sbtools/elf.c
index 5d5e1a786c..adf876e5c7 100644
--- a/utils/imxtools/sbtools/elf.c
+++ b/utils/imxtools/sbtools/elf.c
@@ -733,7 +733,10 @@ bool elf_read_file(struct elf_params_t *params, elf_read_fn_t read,
sym->name = strdup(&symstrtab[symdata[j].st_name]);
sym->addr = symdata[j].st_value;
sym->size = symdata[j].st_size;
- sym->section = strdup(&strtab[shdr[symdata[j].st_shndx].sh_name]);
+ if(symdata[j].st_shndx == SHN_ABS)
+ sym->section = NULL;
+ else
+ sym->section = strdup(&strtab[shdr[symdata[j].st_shndx].sh_name]);
switch(type)
{
case STT_FUNC: sym->type = ESYT_FUNC; break;
diff --git a/utils/imxtools/sbtools/misc.c b/utils/imxtools/sbtools/misc.c
index 68c769808b..71b3cb600b 100644
--- a/utils/imxtools/sbtools/misc.c
+++ b/utils/imxtools/sbtools/misc.c
@@ -308,7 +308,7 @@ void color(color_t c)
enum sb_version_guess_t guess_sb_version(const char *filename)
{
-#define ret(x) do { fclose(f); return x; } while(0)
+#define ret(x) do { if(f) fclose(f); return x; } while(0)
FILE *f = fopen(filename, "rb");
if(f == NULL)
ret(SB_VERSION_ERR);