[PATCH v1 1/4] IOMUX: Preserve console list if realloc() fails

Andy Shevchenko andy.shevchenko at gmail.com
Wed Dec 16 20:40:30 CET 2020


On Wed, Dec 16, 2020 at 8:05 PM Andy Shevchenko
<andriy.shevchenko at linux.intel.com> wrote:
>
> It's realloc() 101 to avoid `foo = realloc(foo, ...);` call
> due to getting a memory leak.
>
> Actually it's not clear why realloc() has been used here.
> If we shrink the array, the memcpy() overwrites it anyway
> with the contents of a new array. If it becomes bigger,
> same story.
>
> Drop useless realloc() for good and thus preserve console list
> in case of failed allocation.

It seems more patches will come. However, this one, since it is a fix,
can be applied disregarding that fact. Therefore please skip the rest
of the series for now.

-- 
With Best Regards,
Andy Shevchenko


More information about the U-Boot mailing list