You have typed the same line twice. Both are same.
struct list *ptr = (struct list*)malloc(sizeof(struct list*));
Here you have allocated the memory whose size is sizeof(struct list*)
Here struct list * is a pointer to type struct list. so size of any pointer on 32 bit machine is 4 byte and on 64 bit machine its 8 byte.
so you have allocated that much memory.
I think in second option you may be want to ask about this
struct list *ptr = (struct list*)malloc(sizeof(struct list));
Here you have allocated memory whose size is the size of that struct list.