Skip to content
Snippets Groups Projects
Commit b69c1ae1 authored by deuce's avatar deuce
Browse files

Don't malloc() the new title.

parent 4db10fe3
No related branches found
No related tags found
No related merge requests found
...@@ -512,15 +512,9 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar ...@@ -512,15 +512,9 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
uint s_bottom=api->scrn_len-3; uint s_bottom=api->scrn_len-3;
uint title_len; uint title_len;
struct uifc_mouse_event mevnt; struct uifc_mouse_event mevnt;
char *title; char title[MAX_OPLN];
if((title=(char *)malloc(strlen(initial_title+1)))==NULL) { sprintf(title,"%.*s",sizeof(title)-1,initial_title);
cprintf("UIFC line %d: error allocating %u bytes\r\n"
,__LINE__,(strlen(initial_title+1)));
_setcursortype(cursor);
return(-1);
}
strcpy(title,initial_title);
hidemouse(); hidemouse();
title_len=strlen(title); title_len=strlen(title);
...@@ -596,7 +590,6 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar ...@@ -596,7 +590,6 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
if((sav[api->savnum].buf=(char *)MALLOC((width+3)*(height+2)*2))==NULL) { if((sav[api->savnum].buf=(char *)MALLOC((width+3)*(height+2)*2))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes." cprintf("UIFC line %d: error allocating %u bytes."
,__LINE__,(width+3)*(height+2)*2); ,__LINE__,(width+3)*(height+2)*2);
free(title);
return(-1); return(-1);
} }
gettext(s_left+left,s_top+top,s_left+left+width+1 gettext(s_left+left,s_top+top,s_left+left+width+1
...@@ -618,7 +611,6 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar ...@@ -618,7 +611,6 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
if((sav[api->savnum].buf=(char *)MALLOC((width+3)*(height+2)*2))==NULL) { if((sav[api->savnum].buf=(char *)MALLOC((width+3)*(height+2)*2))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes." cprintf("UIFC line %d: error allocating %u bytes."
,__LINE__,(width+3)*(height+2)*2); ,__LINE__,(width+3)*(height+2)*2);
free(title);
return(-1); return(-1);
} }
gettext(s_left+left,s_top+top,s_left+left+width+1 gettext(s_left+left,s_top+top,s_left+left+width+1
...@@ -689,7 +681,6 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar ...@@ -689,7 +681,6 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
*(ptr++)=title[i]; *(ptr++)=title[i];
*(ptr++)=hclr|(bclr<<4); *(ptr++)=hclr|(bclr<<4);
} }
free(title);
for(i=0;i<width-(a+b)-2;i++) { for(i=0;i<width-(a+b)-2;i++) {
*(ptr++)=' '; *(ptr++)=' ';
*(ptr++)=hclr|(bclr<<4); *(ptr++)=hclr|(bclr<<4);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment