diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-02-27 16:11:15 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-02-27 16:11:15 +0000 |
commit | 434bd8ec146b5001f8f20ee893f13ba8ba478be9 (patch) | |
tree | de3539020bfbe0401c111c7d814a31db1ed84d3f | |
parent | 0e4cdd67c066154905d2df423bf47172e748415a (diff) | |
download | mana-434bd8ec146b5001f8f20ee893f13ba8ba478be9.tar.gz mana-434bd8ec146b5001f8f20ee893f13ba8ba478be9.tar.bz2 mana-434bd8ec146b5001f8f20ee893f13ba8ba478be9.tar.xz mana-434bd8ec146b5001f8f20ee893f13ba8ba478be9.zip |
Memory fixes
-rw-r--r-- | src/gui/setup.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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 <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <memory.h> 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"); } } |