diff --git a/C/irc.c b/C/irc.c index e890ff1..0688fe9 100644 --- a/C/irc.c +++ b/C/irc.c @@ -51,6 +51,7 @@ int IRCC_connect(IRCC_client *irc, const char *ip, const int port) { if (status == -1) return IRCC_ERROR; + irc->irc_alloc = 1; return IRCC_SUCCESS; } @@ -218,6 +219,9 @@ int IRCC_initssl(IRCC_client *irc) { } void IRCC_close(IRCC_client *irc) { + if (!irc->irc_alloc) + return; + close(irc->irc_socket); irc->irc_msg = irc->irc_nick = irc->irc_channel = NULL; diff --git a/C/irc.h b/C/irc.h index 64d9b13..b16b72a 100644 --- a/C/irc.h +++ b/C/irc.h @@ -12,7 +12,7 @@ #define IRCC_MSG_MAX 512 #define IRCC_PING_TIMEOUT 600 -#define IRCC_VERSION "2.0" +#define IRCC_VERSION "2.0.1" #if defined(ENABLE_SSL) || defined(ENABLE_TLS) #include @@ -44,6 +44,8 @@ typedef struct { char *irc_channel; char *irc_nick; + int irc_alloc; + #if defined(ENABLE_SSL) || defined(ENABLE_TLS) /* RONLY */ int irc_usingssl;