Use After Free
cCopy codechar *ptr = malloc(10);
free(ptr);
strcpy(ptr, "data");cCopy codechar *ptr = malloc(10);
strcpy(ptr, "data");
free(ptr);
ptr = NULL;cppCopy codeint *ptr = new int[10];
delete[] ptr;
ptr[0] = 1;Last updated
cCopy codechar *ptr = malloc(10);
free(ptr);
strcpy(ptr, "data");cCopy codechar *ptr = malloc(10);
strcpy(ptr, "data");
free(ptr);
ptr = NULL;cppCopy codeint *ptr = new int[10];
delete[] ptr;
ptr[0] = 1;Last updated
cppCopy codeint *ptr = new int[10];
delete[] ptr;
ptr = nullptr;