diff --git a/src/channel.c b/src/channel.c index c289e8875..25fd25828 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1101,8 +1101,7 @@ aChannel *get_channel(aClient *cptr, char *chname, int flag) return (chptr); if (flag == CREATE) { - chptr = (aChannel *)MyMalloc(sizeof(aChannel) + len); - bzero((char *)chptr, sizeof(aChannel)); + chptr = MyMallocEx(sizeof(aChannel) + len); strlcpy(chptr->chname, chname, len + 1); if (channel) channel->prevch = chptr; diff --git a/src/list.c b/src/list.c index e30a1fc8f..f8866ac82 100644 --- a/src/list.c +++ b/src/list.c @@ -128,9 +128,7 @@ aClient *make_client(aClient *from, aClient *servr) if (!from) size = CLIENT_LOCAL_SIZE; - if (!(cptr = (aClient *)MyMalloc(size))) - outofmemory(); - bzero((char *)cptr, (int)size); + cptr = MyMallocEx(size); #ifdef DEBUGMODE if (size == CLIENT_LOCAL_SIZE) diff --git a/src/packet.c b/src/packet.c index ba0937f79..d45a2434d 100644 --- a/src/packet.c +++ b/src/packet.c @@ -103,9 +103,7 @@ void init_CommandHash(void) aCommand *add_Command_backend(char *cmd, int (*func)(), unsigned char parameters, int flags) { - aCommand *newcmd = (aCommand *) MyMalloc(sizeof(aCommand)); - - bzero(newcmd, sizeof(aCommand)); + aCommand *newcmd = MyMallocEx(sizeof(aCommand)); newcmd->cmd = (char *) strdup(cmd); newcmd->parameters = (parameters > MAXPARA) ? MAXPARA : parameters; diff --git a/src/umodes.c b/src/umodes.c index 7c91dd26f..d7ec324ce 100644 --- a/src/umodes.c +++ b/src/umodes.c @@ -85,8 +85,7 @@ void umode_init(void) { long val = 1; int i; - Usermode_Table = MyMalloc(sizeof(Umode) * UMODETABLESZ); - bzero(Usermode_Table, sizeof(Umode) * UMODETABLESZ); + Usermode_Table = MyMallocEx(sizeof(Umode) * UMODETABLESZ); for (i = 0; i < UMODETABLESZ; i++) { Usermode_Table[i].mode = val; @@ -94,8 +93,7 @@ void umode_init(void) } Usermode_highest = 0; - Snomask_Table = MyMalloc(sizeof(Snomask) * UMODETABLESZ); - bzero(Snomask_Table, sizeof(Snomask) * UMODETABLESZ); + Snomask_Table = MyMallocEx(sizeof(Snomask) * UMODETABLESZ); val = 1; for (i = 0; i < UMODETABLESZ; i++) { diff --git a/src/win32/editor.c b/src/win32/editor.c index d55424a95..dc923b00f 100644 --- a/src/win32/editor.c +++ b/src/win32/editor.c @@ -338,7 +338,7 @@ LRESULT CALLBACK FromFileDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar int fd,len; unsigned char *buffer = '\0', *string = '\0'; EDITSTREAM edit; - StreamIO *stream = malloc(sizeof(StreamIO)); + StreamIO *stream = MyMallocEx(sizeof(StreamIO)); unsigned char szText[256]; struct stat sb; HWND hWnd = GetDlgItem(hDlg, IDC_TEXT), hTip; @@ -360,13 +360,11 @@ LRESULT CALLBACK FromFileDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPar { fstat(fd,&sb); /* Only allocate the amount we need */ - buffer = malloc(sb.st_size+1); - buffer[0] = 0; + buffer = MyMallocEx(sb.st_size+1); len = read(fd, buffer, sb.st_size); buffer[len] = 0; len = CountRTFSize(buffer)+1; - string = malloc(len); - bzero(string,len); + string = MyMallocEx(len); IRCToRTF(buffer,string); RTFBuf = string; len--; diff --git a/src/win32/gui.c b/src/win32/gui.c index c99510a82..85de37d9c 100644 --- a/src/win32/gui.c +++ b/src/win32/gui.c @@ -663,10 +663,10 @@ LRESULT CALLBACK FromVarDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPara unsigned char String[16384]; int size; unsigned char *RTFString; - StreamIO *stream = malloc(sizeof(StreamIO)); + StreamIO *stream = MyMallocEx(sizeof(StreamIO)); EDITSTREAM edit; SetWindowText(hDlg, title); - bzero(String, 16384); + bzero(String, sizeof(String)); lpfnOldWndProc = (FARPROC)SetWindowLong(GetDlgItem(hDlg, IDC_TEXT), GWL_WNDPROC, (DWORD)RESubClassFunc); while (*s) { @@ -675,8 +675,7 @@ LRESULT CALLBACK FromVarDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPara strcat(String, "\r\n"); } size = CountRTFSize(String)+1; - RTFString = malloc(size); - bzero(RTFString, size); + RTFString = MyMallocEx(size); IRCToRTF(String,RTFString); RTFBuf = RTFString; size--; @@ -746,7 +745,7 @@ LRESULT CALLBACK FromFileReadDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM int fd,len; unsigned char *buffer = '\0', *string = '\0'; EDITSTREAM edit; - StreamIO *stream = malloc(sizeof(StreamIO)); + StreamIO *stream = MyMallocEx(sizeof(StreamIO)); unsigned char szText[256]; struct stat sb; HWND hWnd = GetDlgItem(hDlg, IDC_TEXT), hTip; @@ -757,13 +756,12 @@ LRESULT CALLBACK FromFileReadDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM { fstat(fd,&sb); /* Only allocate the amount we need */ - buffer = malloc(sb.st_size+1); + buffer = MyMallocEx(sb.st_size+1); buffer[0] = 0; len = read(fd, buffer, sb.st_size); buffer[len] = 0; len = CountRTFSize(buffer)+1; - string = malloc(len); - bzero(string,len); + string = MyMallocEx(len); IRCToRTF(buffer,string); RTFBuf = string; len--;