From cb58ff858b2b741abc9a7396bd481b7a145ca796 Mon Sep 17 00:00:00 2001 From: William Kendrick Date: Sun, 27 Jul 2003 02:41:34 +0000 Subject: [PATCH] Had forgotten a realloc()! --- src/tuxpaint.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 7a27952f3..5ec74bb08 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -10413,7 +10413,21 @@ void loadfonts(char * dir, int fatal) d_names[num_files] = strdup(f->d_name); num_files++; - /* FIXME: realloc */ + if (num_files >= d_names_alloced) + { + d_names_alloced = d_names_alloced + 32; + d_names = (char * *) realloc(sizeof(char *) * d_names_alloced); + + if (d_names == NULL) + { + fprintf(stderr, + "\nError: I can't allocate memory for directory listing!\n" + "The system error that occurred was: %s\n", + strerror(errno)); + cleanup(); + exit(1); + } + } } } while (f != NULL);