From 434bd8ec146b5001f8f20ee893f13ba8ba478be9 Mon Sep 17 00:00:00 2001 From: Eugenio Favalli Date: Sun, 27 Feb 2005 16:11:15 +0000 Subject: Memory fixes --- src/gui/setup.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 5d8f3ca5..ea2bb6bf 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -34,6 +34,10 @@ #include "radiobutton.h" #include "ok_dialog.h" #include "../main.h" +#include +#include +#include +#include SDL_Rect **modes; @@ -54,11 +58,13 @@ ModeListModel::ModeListModel() { for(nmode=0;modes[nmode];++nmode); - mode = (char **) calloc(nmode,sizeof(char *)); + mode = (char **) calloc(nmode, sizeof(char *)); for(i=0;modes[i];++i) { - if(asprintf(&mode[i], "%d x %d", modes[i]->w, modes[i]->h) == -1) - puts("Cannot allocate mode list"); + char *temp = (char *)malloc(20 * sizeof(char)); + mode[i] = temp; + if(sprintf(mode[i], "%d x %d", modes[i]->w, modes[i]->h) == -1) + puts("Cannot allocate mode list"); } } -- cgit v1.2.3-70-g09d2