FreeStrBuf(&ptr->IO.SendBuf.Buf);
FreeStrBuf(&ptr->IO.RecvBuf.Buf);
DeleteAsyncMsg(&ptr->IO.ReadMsg);
- ((struct CitContext*)ptr->IO.CitContext)->state = CON_IDLE;
- ((struct CitContext*)ptr->IO.CitContext)->kill_me = 1;
+ if (((struct CitContext*)ptr->IO.CitContext)) {
+ ((struct CitContext*)ptr->IO.CitContext)->state = CON_IDLE;
+ ((struct CitContext*)ptr->IO.CitContext)->kill_me = 1;
+ }
FreeAsyncIOContents(&ptr->IO);
free(ptr);
}