1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-08 23:03:12 +02:00

Use MyMallocEx and not malloc/MyMalloc + bzero.

This commit is contained in:
Bram Matthys
2015-07-16 17:29:24 +02:00
parent c06dc9a142
commit bad3cdbdeb
6 changed files with 14 additions and 25 deletions
+1 -2
View File
@@ -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;
+1 -3
View File
@@ -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)
+1 -3
View File
@@ -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;
+2 -4
View File
@@ -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++)
{
+3 -5
View File
@@ -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--;
+6 -8
View File
@@ -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--;