mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
Check for NULL parameter in gdk_font_load. Plug a memory leak in gdkim.c.
This commit is contained in:
parent
0c178e965c
commit
700891684e
@ -54,6 +54,8 @@ gdk_font_load (const gchar *font_name)
|
||||
int nHeight, nWidth, nEscapement, nOrientation, fnWeight;
|
||||
int logpixelsy;
|
||||
|
||||
g_return_val_if_fail (font_name != NULL, NULL);
|
||||
|
||||
private = g_new (GdkFontPrivate, 1);
|
||||
font = (GdkFont*) private;
|
||||
|
||||
|
@ -54,6 +54,8 @@ gdk_font_load (const gchar *font_name)
|
||||
int nHeight, nWidth, nEscapement, nOrientation, fnWeight;
|
||||
int logpixelsy;
|
||||
|
||||
g_return_val_if_fail (font_name != NULL, NULL);
|
||||
|
||||
private = g_new (GdkFontPrivate, 1);
|
||||
font = (GdkFont*) private;
|
||||
|
||||
|
@ -186,7 +186,6 @@ gdk_wcstombs (const GdkWChar *src)
|
||||
}
|
||||
mbstr[mbsl] = '\0';
|
||||
g_free (src_alt);
|
||||
return mbstr;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -233,6 +232,7 @@ gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
|
||||
wcsl = dest_max;
|
||||
for (i = 0; i < wcsl; i++)
|
||||
dest[i] = wcstr[i];
|
||||
g_free (wcstr);
|
||||
|
||||
return wcsl;
|
||||
}
|
||||
|
@ -186,7 +186,6 @@ gdk_wcstombs (const GdkWChar *src)
|
||||
}
|
||||
mbstr[mbsl] = '\0';
|
||||
g_free (src_alt);
|
||||
return mbstr;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -233,6 +232,7 @@ gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
|
||||
wcsl = dest_max;
|
||||
for (i = 0; i < wcsl; i++)
|
||||
dest[i] = wcstr[i];
|
||||
g_free (wcstr);
|
||||
|
||||
return wcsl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user