fix bug of free null pointer

This commit is contained in:
Vincent Wei
2018-08-25 18:27:37 +08:00
parent 1935734df1
commit e7924ebd51
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -397,7 +397,7 @@ build_bmpfont_info (const char *bmpfont_name, const BITMAP* glyph_bmp,
return NULL;
/* set name */
strncpy (bmpfont_info->name , bmpfont_name, LEN_UNIDEVFONT_NAME);
strncpy (bmpfont_info->name, bmpfont_name, LEN_UNIDEVFONT_NAME);
bmpfont_info->name [LEN_UNIDEVFONT_NAME] = '\0';
/* set height */
+2 -1
View File
@@ -3556,7 +3556,8 @@ static void destroy_dc_state (DCSTATE* dc_state, BOOL empty_crgn)
{
if (empty_crgn)
EmptyClipRgn (&dc_state->lcrgn);
free (dc_state->pal.colors);
if (dc_state->pal.colors)
free (dc_state->pal.colors);
free (dc_state);
}
+2 -1
View File
@@ -311,7 +311,8 @@ HICON GUIAPI LoadIconFromMem (HDC hdc, const void* area, int which)
imagew = MGUI_ReadLE32Mem (&p);
imageh = MGUI_ReadLE32Mem (&p);
#else
p += sizeof(DWORD32);
p += sizeof(DWORD32);
p += sizeof(DWORD32);
#endif
/* check the biPlanes member; */
wTemp = MGUI_ReadLE16Mem (&p);