summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-08-04 21:31:54 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-08-06 21:24:38 +0200
commit8e69c37b5a8b2b9a1cf9892b38415cd6c2c33b60 (patch)
tree6cdcd34be10baa31f00508d35e026973091caee8
parente69293ecdba18bbd4496209914d482f3b9fc97a2 (diff)
sbtools: various fixes
Change-Id: I82c4642aea325cf22d66e9b49fc2d47319cd70eb
-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);