summaryrefslogtreecommitdiff
path: root/util/intelvbttool
diff options
context:
space:
mode:
Diffstat (limited to 'util/intelvbttool')
-rw-r--r--util/intelvbttool/intelvbttool.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/intelvbttool/intelvbttool.c b/util/intelvbttool/intelvbttool.c
index f8e4bda0f4..715b39ad57 100644
--- a/util/intelvbttool/intelvbttool.c
+++ b/util/intelvbttool/intelvbttool.c
@@ -1028,8 +1028,10 @@ static int patch_vbios(struct fileobject *fo,
if (old_vbt) {
if (oh->vbt_offset + vbt_size(old_vbt) == fo->size) {
/* Located at the end of file - reduce file size */
- if (fo->size < vbt_size(old_vbt))
+ if (fo->size < vbt_size(old_vbt)) {
+ free_fo(old_vbt);
return 1;
+ }
fo = remalloc_fo(fo, fo->size - vbt_size(old_vbt));
if (!fo) {
printerr("Failed to allocate memory\n");