diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-09-30 20:19:44 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-09-30 20:19:44 -0700 |
commit | 4acfec7c03865144491f913694f8dca17072d13e (patch) | |
tree | afd79da277c670eb98bca677226c21e80b2c10f9 | |
parent | edca92c10572b6bb7dd60db156f545d98373f803 (diff) |
Call realloc() instead of open coding it
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r-- | server.c | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -212,13 +212,9 @@ SaveBytes ( { /* not enough room so far; malloc more space and copy */ long SizeofNewBytes = (CS[fd].NumberofSavedBytes + n + 1); - unsigned char *NewBytes = malloc (SizeofNewBytes); + unsigned char *NewBytes = realloc (CS[fd].SavedBytes, 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(CS[fd].SavedBytes); CS[fd].SavedBytes = NewBytes; CS[fd].SizeofSavedBytes = SizeofNewBytes; } |