src/pch.c (another_hunk): Call set_hunkmax() from here to make sure it is
called even when falling back from plan A to plan B.
(open_patch_file): No need to call set_hunkmax() anymore.
src/pch.c (set_hunkmax): Fail when out of memory. Make static.
src/pch.h: Remove set_hunkmax() prototype.
Change-Id: Ibbab473998ef297844787b033cca52f8a7b4e86d
Signed-off-by: JinWang An <jinwang.an@samsung.com>
set_hunkmax (void)
{
if (!p_line)
- p_line = (char **) malloc (hunkmax * sizeof *p_line);
+ p_line = (char **) xmalloc (hunkmax * sizeof *p_line);
if (!p_len)
- p_len = (size_t *) malloc (hunkmax * sizeof *p_len);
+ p_len = (size_t *) xmalloc (hunkmax * sizeof *p_len);
if (!p_Char)
- p_Char = malloc (hunkmax * sizeof *p_Char);
+ p_Char = xmalloc (hunkmax * sizeof *p_Char);
}
/* Enlarge the arrays containing the current hunk of patch. */