这里为什么会有Segementation fault呢


#include<stdio.h>
#include<stdlib.h>
typedef struct SNode *Stack;
struct SNode
{
    int Data;
    struct SNode *Next;
};

Stack CreatStack()
{
    Stack S;
    S = (Stack)malloc(sizeof(struct SNode));
    S->Next == NULL;
    return S;
}

int IsEmpty(Stack S)
{
    return (S->Next == NULL);
}

void Push(Stack S,int X)
{
    struct SNode *TmpCell;
    TmpCell = (struct SNode *)malloc(sizeof(struct SNode));
    TmpCell->Data = X;
    TmpCell->Next = S->Next;
    S->Next = TmpCell;
}

int Pop(Stack S)
{
    struct SNode *FirstCell;
    int TmpData;
    if(IsEmpty(S)){
        printf("堆栈空");
        return NULL;
    }else{
        FirstCell = S->Next;
        S->Next = FirstCell->Next;
        TmpData = FirstCell->Data;
        free(FirstCell);
        return TmpData;
    }
}

第15行: S->Next = NULL;//S->Next == NULL;