mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-28 01:59:49 +00:00
lib/reloacator: Fix memory leaks
Fix memory leaks in grub_relocator_alloc_chunk_align(). Fixes: CID 473844 Signed-off-by: Lidong Chen <lidong.chen@oracle.com> Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
f3f1fcecdc
commit
1d00594475
1 file changed
+5
-1
@@ -1440,6 +1440,7 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
grub_free (ctx.chunk);
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||||
}
|
}
|
||||||
while (0);
|
while (0);
|
||||||
@@ -1456,7 +1457,10 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel,
|
|||||||
grub_mmap_iterate (grub_relocator_alloc_chunk_align_iter, &ctx);
|
grub_mmap_iterate (grub_relocator_alloc_chunk_align_iter, &ctx);
|
||||||
#endif
|
#endif
|
||||||
if (!ctx.found)
|
if (!ctx.found)
|
||||||
return grub_error (GRUB_ERR_BAD_OS, "couldn't find suitable memory target");
|
{
|
||||||
|
grub_free (ctx.chunk);
|
||||||
|
return grub_error (GRUB_ERR_BAD_OS, "couldn't find suitable memory target");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user