Hi Patrick, On Fri, 10 Jan 2020 08:50:31 +0100 Patrick Delaunay patrick.delau...@st.com wrote: ... > diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c > index 8f44f599c1..bcf06b871d 100644 > --- a/tools/fdtgrep.c > +++ b/tools/fdtgrep.c > @@ -823,8 +823,10 @@ static int do_fdtgrep(struct display_info *disp, const > char *filename) > } > if (count <= max_regions) > break; > + } > + if (count > max_regions) { > free(region);
This change moved free(region) out of the loop. If you do so, then please also change malloc() in the loop to realloc(): region = realloc(region, count * sizeof(struct fdt_region)); -- Anatolij