From edca92c10572b6bb7dd60db156f545d98373f803 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 30 Sep 2011 20:19:44 -0700 Subject: Stop wrapping malloc & free Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston --- server.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'server.c') diff --git a/server.c b/server.c index e9c1d9e..0943eec 100644 --- a/server.c +++ b/server.c @@ -212,11 +212,13 @@ SaveBytes ( { /* not enough room so far; malloc more space and copy */ long SizeofNewBytes = (CS[fd].NumberofSavedBytes + n + 1); - unsigned char *NewBytes = (unsigned char *)Malloc (SizeofNewBytes); + unsigned char *NewBytes = malloc (SizeofNewBytes); + if (NewBytes == NULL) + panic("Can't allocate memory for SavedBytes"); bcopy(/* from */(char *)CS[fd].SavedBytes, /* to */(char *)NewBytes, /* count */(int)CS[fd].SizeofSavedBytes); - Free((char *)CS[fd].SavedBytes); + free(CS[fd].SavedBytes); CS[fd].SavedBytes = NewBytes; CS[fd].SizeofSavedBytes = SizeofNewBytes; } @@ -471,7 +473,7 @@ StopClientConnection ( /* when a new connection is stopped, discard the old buffer */ if (CS[fd].SizeofSavedBytes > 0) - Free((char*)CS[fd].SavedBytes); + free(CS[fd].SavedBytes); } long @@ -622,7 +624,7 @@ StopServerConnection ( /* when a new connection is stopped, discard the old buffer */ if (CS[fd].SizeofSavedBytes > 0) - Free((char *)CS[fd].SavedBytes); + free(CS[fd].SavedBytes); } long -- cgit v1.2.1