On Thu, Nov 20, 2025 at 01:41:41PM +0530, Avnish Chouhan wrote: > Adding a fix for hist_lines memory leak and state loss. In > current code, we overwrite hist_lines before checking the > allocation result. If grub_calloc fails, hist_lines becomes NULL > and we loose the reference to the previously allocated hist_lines. > With this new change. On failure, hist_lines remains pointing to > the old valid memory. No leak, no state corruption. > > Along with this, adding a failure check in grub_calloc(). If > grub_calloc fails, (e.g., due to memory allocation failure), > it returns NULL. Then, passing hist_lines (which would be NULL) > to grub_memmove() will result in a null pointer dereference, > and can cause an undefined behavior. > > Signed-off-by: Avnish Chouhan <[email protected]>
Reviewed-by: Daniel Kiper <[email protected]> Daniel _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
