The following function is causing a memory violation. What line could not be responsible? 1 char *my_strdup(char *str) 2 { 3 int i; 4 char *str2 = malloc(strlen(str)); 5 int length = strlen(str); 6 for(i = 0; i <= length; i++) 7 str2[i] = str[i]; 8 str2[i] = '\0'; 9 return str2; 10 }
4
6
7
8