1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/* * Rule: STR38-C * Source: wiki * Status: FAIL - Should trigger STR38-C violation */ #include <stdlib.h> #include <string.h> void func(void) { wchar_t wide_str1[] = L"0123456789"; wchar_t *wide_str2 = (wchar_t*)malloc(strlen(wide_str1) + 1); if (wide_str2 == NULL) { /* Handle error */ } /* ... */ free(wide_str2); wide_str2 = NULL; }