Add test case for #10137 (#3558)

This commit is contained in:
chrchr-github 2021-11-11 20:25:10 +01:00 committed by GitHub
parent 771188238c
commit 49d3e07b59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -4737,6 +4737,19 @@ private:
" return foo(1, &single_value);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
check("void f(const char* app, size_t applen) {\n" // #10137
" char* tmp_de = NULL;\n"
" char** str = &tmp_de;\n"
" char* tmp = (char*)realloc(*str, applen + 1);\n"
" if (tmp) {\n"
" *str = tmp;\n"
" memcpy(*str, app, applen);\n"
" (*str)[applen] = '\\0';\n"
" }\n"
" free(*str);\n"
"}\n", "test.c");
ASSERT_EQUALS("", errout.str());
}
};