Doubt from pointers

Q) What is the problem with the following code:
#include <stdio.h>
int main()
{
int *ptr = (int *)malloc(sizeof(int));
ptr = NULL;
free(ptr);
}

Please provide with the question. :slight_smile: