Fixed list realloc

This commit is contained in:
simon.kagstrom 2009-01-03 09:52:49 +00:00
parent fceafc55fd
commit 6e6aea5e54

View File

@ -136,10 +136,10 @@ void C64::select_disc(Prefs *np)
p = strdup(de->d_name); p = strdup(de->d_name);
file_list[cur++] = p; file_list[cur++] = p;
file_list[cur] = NULL; file_list[cur] = NULL;
if (cur > cnt - 1) if (cur > cnt - 2)
{ {
cnt = cnt + 32; cnt = cnt + 32;
file_list = (char**)realloc(file_list, cnt); file_list = (char**)realloc(file_list, cnt * sizeof(char*));
if (!file_list) if (!file_list)
return; return;
} }