Attention is currently required from: Nico Huber, Edward O'Callaghan, Anastasia Klimchuk. Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/54890 )
Change subject: programmer: Introduce default shutdown function ......................................................................
Patch Set 2:
(1 comment)
File flashrom.c:
https://review.coreboot.org/c/flashrom/+/54890/comment/bd52daab_2a9fbcaa PS2, Line 558: if (data) : free(data); The check is redundant. Remember that CB:54905 has an explanation? 😊
<randomthoughts>
What would cause problems (undefined behavior) is passing a non-NULL but invalid pointer:
- A pointer not returned by an allocation function: malloc(), calloc(), realloc(), etc. - A pointer to dynamically-allocated memory that free() or realloc() has already released.
There's no way to know this from within this function, though. And it would be a bug in the programmer code anyway. I'd add a comment explaining this, but we know what happens with comments: no one reads them, but when someone does, the comment is rotten (outdated and/or wrong). I mean, the comment right below mentions an atexit() function, which no longer exists...
</randomthoughts>