From c99c3459c8dea8bfeaafe5e9a87a09ccba937a6e Mon Sep 17 00:00:00 2001 From: cohrs Date: Fri, 23 Feb 2007 03:44:50 +0000 Subject: [PATCH] saved game memory initialization (dev only) Qt windowport crashed on startup because a couple alloc() calls in files.c were not zero'ing out the memory afterward. This resulted in uninit'd memory access if there were no saved games. This bug is in new dev code. --- src/files.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/files.c b/src/files.c index 6466b0087..5056b708a 100644 --- a/src/files.c +++ b/src/files.c @@ -1083,6 +1083,7 @@ get_saved_games() } if (n > 0) { result = (char**)alloc((n+1)*sizeof(char*)); /* at most */ + (void) memset((genericptr_t) result, 0, (n+1)*sizeof(char*)); if (findfirst((char *)fq_save)) { j = n = 0; do { @@ -1110,6 +1111,7 @@ get_saved_games() if(!(dir=opendir(fqname("save", SAVEPREFIX, 0)))) return 0; result = (char**)alloc((n+1)*sizeof(char*)); /* at most */ + (void) memset((genericptr_t) result, 0, (n+1)*sizeof(char*)); for (i=0, j=0; i