CID 132822 (#1 of 1): Resource leak (RESOURCE_LEAK) 9. leaked_storage: Variable newname going out of scope leaks the storage it points to Signed-off-by: Jean-Christophe Dubois <jcd@xxxxxxxxxxxxxxx> --- convert-dtsv0-lexer.l | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/convert-dtsv0-lexer.l b/convert-dtsv0-lexer.l index 259e527..8d8289b 100644 --- a/convert-dtsv0-lexer.l +++ b/convert-dtsv0-lexer.l @@ -208,6 +208,12 @@ static void convert_file(const char *fname) char *newname; newname = xmalloc(len + sizeof(suffix)); + + if (!newname) { + die("failed to allocate memory for input file %s: %s\n", + fname, strerror(errno)); + } + memcpy(newname, fname, len); memcpy(newname + len, suffix, sizeof(suffix)); @@ -223,6 +229,8 @@ static void convert_file(const char *fname) while(yylex()) ; + + free(newname); } int main(int argc, char *argv[]) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html