Can you please explain this question in depth

Q­4 What is the problem with the following code #include<stdio.h>
int main()
{
int *ptr = (int *)malloc(sizeof(int));
ptr = NULL;
free(ptr);
}
A) Dangling Pointer
B) Memory leak
C) The program may crash as free() is called for NULL pointer.
D) Compiler Error

The problem is related to memory leak, since here, you are creating a pointer of integers, using malloc (), and then you are pointing it to NULL location, and since you are trying to free the NULL value, it would lead to memory leak