
16 Dec
2020
16 Dec
'20
8:40 p.m.
On Wed, Dec 16, 2020 at 8:05 PM Andy Shevchenko andriy.shevchenko@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