Attention is currently required from: Edward O'Callaghan, Angel Pons, Anastasia Klimchuk.
Felix Singer has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/70006 )
Change subject: layout: Check return values for strdup in register_include_arg ......................................................................
Patch Set 3:
(4 comments)
File layout.c:
https://review.coreboot.org/c/flashrom/+/70006/comment/cfe0ec42_17bcabf6 PS2, Line 139: || file == NULL
Yes I forgot that indeed file is optional parameter. […]
Line 144 causes a memory leak now. If a colon is found but the second parameter (the file name) isn't given, then `name` doesn't get freed because line 144 just returns. That's why I suggested to leave that code where it is and to just extend that if-block, so that we error out early as possible.
You can either replace that return with `goto error` or you move lines 140-152 below line 131, where they were before. I prefer the latter.
File layout.c:
https://review.coreboot.org/c/flashrom/+/70006/comment/1511c23a_63309098 PS3, Line 135: if (name == NULL) { nit: `!name`
https://review.coreboot.org/c/flashrom/+/70006/comment/9ff374eb_419a66a6 PS3, Line 142: if(!colon[1]) { mising space `if (`
https://review.coreboot.org/c/flashrom/+/70006/comment/b94b0165_679e6b6f PS3, Line 148: if (file == NULL) { nit: `!file`