--- libaitcli/src/telnet.c 2011/05/29 22:49:25 1.2 +++ libaitcli/src/telnet.c 2012/07/22 22:37:08 1.3 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: telnet.c,v 1.2 2011/05/29 22:49:25 misho Exp $ +* $Id: telnet.c,v 1.3 2012/07/22 22:37:08 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 +Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -137,7 +137,7 @@ cli_telnetRecv(int sock, struct telnetAttrs **attr, in ta.ta_cmd = buf[i]; if (SB > ta.ta_cmd) { (*nAttr)++; - *attr = realloc(*attr, sizeof(struct telnetAttrs) * *nAttr); + *attr = io_realloc(*attr, sizeof(struct telnetAttrs) * *nAttr); if (!*attr) { LOGERR; return -1; @@ -167,7 +167,7 @@ cmd_exit: ta.ta_opt = buf[i]; if (SB != ta.ta_cmd) { (*nAttr)++; - *attr = realloc(*attr, sizeof(struct telnetAttrs) * *nAttr); + *attr = io_realloc(*attr, sizeof(struct telnetAttrs) * *nAttr); if (!*attr) { LOGERR; return -1; @@ -192,7 +192,7 @@ opt_exit: ta.ta_sub[ta.ta_sublen] = 0; (*nAttr)++; - *attr = realloc(*attr, sizeof(struct telnetAttrs) * *nAttr); + *attr = io_realloc(*attr, sizeof(struct telnetAttrs) * *nAttr); if (!*attr) { LOGERR; return -1; @@ -203,7 +203,7 @@ opt_exit: ta.ta_sub[ta.ta_sublen++] = buf[i]; } else { cli_SetErr(EPROTONOSUPPORT, "Protocol limitation in sub-option to %d!", MAX_SUB_LEN); - free(*attr); + io_free(*attr); *nAttr = 0; return -1; } @@ -266,7 +266,7 @@ cli_telnetSend(int sock, struct telnetAttrs *attr, int } } - buf = realloc(buf, pos + len); + buf = io_realloc(buf, pos + len); if (!buf) { LOGERR; return -1; @@ -290,7 +290,7 @@ cli_telnetSend(int sock, struct telnetAttrs *attr, int /* add data */ if (data && datLen) { - buf = realloc(buf, pos + datLen); + buf = io_realloc(buf, pos + datLen); if (!buf) { LOGERR; return -1; @@ -303,7 +303,7 @@ cli_telnetSend(int sock, struct telnetAttrs *attr, int /* add GA after end of all */ if (Term) { - buf = realloc(buf, pos + 2); + buf = io_realloc(buf, pos + 2); if (!buf) { LOGERR; return -1; @@ -318,7 +318,7 @@ cli_telnetSend(int sock, struct telnetAttrs *attr, int LOGERR; if (buf) - free(buf); + io_free(buf); return writeLen; } @@ -485,7 +485,7 @@ cli_telnet_SetCmd(struct telnetAttrs *attr, u_char cmd * @nCaps = number of capability options * @attr = input attribute * @nAttr = number of input attributes - * @ans = output answered attributes, must be free() after use + * @ans = output answered attributes, must be io_free() after use * @Ans = number of output answered attributes * return: -1 can`t answer; !=-1 ok */ @@ -521,7 +521,7 @@ cli_telnet_Answer(u_char *caps, int nCaps, struct teln // make attribute ... if (flg > -1) { (*Ans)++; - *ans = realloc(*ans, sizeof(struct telnetAttrs) * *Ans); + *ans = io_realloc(*ans, sizeof(struct telnetAttrs) * *Ans); if (!*ans) { LOGERR; return -1;