This patch fixes warning at:
Unix API, Allocator sizeof operand mismatch,
libr/bin/format/elf/elf.c:982
diff --git a/libr/bin/format/elf/elf.c b/libr/bin/format/elf/elf.c
index 91662d1..67816d7 100644
--- a/libr/bin/format/elf/elf.c
+++ b/libr/bin/format/elf/elf.c
@@ -733,11 +733,13 @@ struct r_bin_elf_reloc_t*
Elf_(r_bin_elf_get_relocs)(struct Elf_(r_bin_elf_obj_t 1);
if (len == -1) {
eprintf ("Error: read (rel)\n");
+ free(rel);
return NULL;
}
}
if ((ret = (struct r_bin_elf_reloc_t *)malloc
((nrel+1) * sizeof (struct r_bin_elf_reloc_t))) == NULL) { perror
("malloc (reloc)");
+ free(rel);
return NULL;
}
j = 0;
@@ -761,6 +763,7 @@ struct r_bin_elf_reloc_t*
Elf_(r_bin_elf_get_relocs)(struct Elf_(r_bin_elf_obj_t ret[j].last = 1;
break;
}
+ free(rel);
return ret;
}
diff --git a/libr/bin/format/elf/elf.c b/libr/bin/format/elf/elf.c
index 91662d1..67816d7 100644
--- a/libr/bin/format/elf/elf.c
+++ b/libr/bin/format/elf/elf.c
@@ -733,11 +733,13 @@ struct r_bin_elf_reloc_t* Elf_(r_bin_elf_get_relocs)(struct Elf_(r_bin_elf_obj_t
1);
if (len == -1) {
eprintf ("Error: read (rel)\n");
+ free(rel);
return NULL;
}
}
if ((ret = (struct r_bin_elf_reloc_t *)malloc ((nrel+1) * sizeof (struct r_bin_elf_reloc_t))) == NULL) {
perror ("malloc (reloc)");
+ free(rel);
return NULL;
}
j = 0;
@@ -761,6 +763,7 @@ struct r_bin_elf_reloc_t* Elf_(r_bin_elf_get_relocs)(struct Elf_(r_bin_elf_obj_t
ret[j].last = 1;
break;
}
+ free(rel);
return ret;
}
_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org