aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-11-17 10:02:04 -0600
committerMatt Strapp <strap012@umn.edu>2020-11-17 10:02:04 -0600
commit2576c33d2b66502955b6381fe1537c51548dbd5f (patch)
treea143f513f24b3a13b62c7d163439aaaae3912580
parentadd most recent things (diff)
downloadcsci4061-2576c33d2b66502955b6381fe1537c51548dbd5f.tar
csci4061-2576c33d2b66502955b6381fe1537c51548dbd5f.tar.gz
csci4061-2576c33d2b66502955b6381fe1537c51548dbd5f.tar.bz2
csci4061-2576c33d2b66502955b6381fe1537c51548dbd5f.tar.lz
csci4061-2576c33d2b66502955b6381fe1537c51548dbd5f.tar.xz
csci4061-2576c33d2b66502955b6381fe1537c51548dbd5f.tar.zst
csci4061-2576c33d2b66502955b6381fe1537c51548dbd5f.zip
Deal with stsah
Diffstat (limited to '')
-rw-r--r--P3/server.c5
1 files changed, 3 insertions, 2 deletions
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;
}
}