From 2576c33d2b66502955b6381fe1537c51548dbd5f Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Tue, 17 Nov 2020 10:02:04 -0600 Subject: Deal with stsah --- P3/server.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'P3/server.c') diff --git a/P3/server.c b/P3/server.c index 8b26864..e4aeef4 100644 --- a/P3/server.c +++ b/P3/server.c @@ -272,9 +272,10 @@ int main(int argc, char **argv) { cache_entry_t *dynQ; if (cSiz != 0) { //Should the queue start this large? - dynQ = (cache_entry_t*) malloc(cSiz * sizeof(cache_entry_t)); + dynQ = (cache_entry_t*) calloc(sizeof(cache_entry_t), cSiz); if (dynQ == NULL) { printf("malloc cannot allocate the initial requested memory.\n"); + exit(-2); } } @@ -320,7 +321,7 @@ int main(int argc, char **argv) { // Remove cache (extra credit B) if (cSiz != 0) free(dynQ); - printf("Aache has successfully been cleared.\nExiting now.\n"); + printf("Cache has successfully been cleared.\nExiting now.\n"); return 0; } } -- cgit v1.2.3