summaryrefslogtreecommitdiff
path: root/src/libelfu/modelops
diff options
context:
space:
mode:
authornorly <ny-git@enpas.org>2013-06-28 03:00:05 +0100
committernorly <ny-git@enpas.org>2013-06-28 03:00:05 +0100
commit88a99f6bafe7140711fa0095043c856fd8c44dc7 (patch)
tree387ebd0a82dcf86193438827c39541b072995014 /src/libelfu/modelops
parent50b85e44529f195bf8156e9c0045d8b017ee26f5 (diff)
Implement memory management TODOs
Diffstat (limited to 'src/libelfu/modelops')
-rw-r--r--src/libelfu/modelops/fromFile.c4
-rw-r--r--src/libelfu/modelops/layout.c7
-rw-r--r--src/libelfu/modelops/reladd.c2
3 files changed, 4 insertions, 9 deletions
diff --git a/src/libelfu/modelops/fromFile.c b/src/libelfu/modelops/fromFile.c
index ef7add9..a4f0384 100644
--- a/src/libelfu/modelops/fromFile.c
+++ b/src/libelfu/modelops/fromFile.c
@@ -460,7 +460,9 @@ ElfuElf* elfu_mFromElf(Elf *e)
}
}
-
+ if (secArray) {
+ free(secArray);
+ }
return me;
diff --git a/src/libelfu/modelops/layout.c b/src/libelfu/modelops/layout.c
index 2fd610c..182ed2e 100644
--- a/src/libelfu/modelops/layout.c
+++ b/src/libelfu/modelops/layout.c
@@ -345,7 +345,6 @@ int elfu_mLayoutAuto(ElfuElf *me)
ElfuPhdr *highestOffsEnd;
ElfuPhdr *mp;
ElfuScn *ms;
- ElfuPhdr **phdrArr;
GElf_Off lastend = 0;
assert(me);
@@ -354,12 +353,6 @@ int elfu_mLayoutAuto(ElfuElf *me)
elfu_mPhdrLoadLowestHighest(me, &lowestAddr, &highestAddr,
&lowestOffs, &highestOffsEnd);
- phdrArr = malloc(elfu_mPhdrCount(me) * sizeof(*phdrArr));
- if (!phdrArr) {
- ELFU_WARN("elfu_mLayoutAuto: malloc failed for phdrArr.\n");
- return 1;
- }
-
lastend = OFFS_END(highestOffsEnd->phdr.p_offset, highestOffsEnd->phdr.p_filesz);
diff --git a/src/libelfu/modelops/reladd.c b/src/libelfu/modelops/reladd.c
index 1980c76..4bc6e40 100644
--- a/src/libelfu/modelops/reladd.c
+++ b/src/libelfu/modelops/reladd.c
@@ -130,7 +130,7 @@ static ElfuScn* insertSection(ElfuElf *me, ElfuElf *mrel, ElfuScn *oldscn)
ERROR:
if (newscn) {
- // TODO: Destroy newscn
+ elfu_mScnDestroy(newscn);
}
return NULL;
}