mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 06:10:21 +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 nHeight, nWidth, nEscapement, nOrientation, fnWeight;
|
||||||
int logpixelsy;
|
int logpixelsy;
|
||||||
|
|
||||||
|
g_return_val_if_fail (font_name != NULL, NULL);
|
||||||
|
|
||||||
private = g_new (GdkFontPrivate, 1);
|
private = g_new (GdkFontPrivate, 1);
|
||||||
font = (GdkFont*) private;
|
font = (GdkFont*) private;
|
||||||
|
|
||||||
|
@ -54,6 +54,8 @@ gdk_font_load (const gchar *font_name)
|
|||||||
int nHeight, nWidth, nEscapement, nOrientation, fnWeight;
|
int nHeight, nWidth, nEscapement, nOrientation, fnWeight;
|
||||||
int logpixelsy;
|
int logpixelsy;
|
||||||
|
|
||||||
|
g_return_val_if_fail (font_name != NULL, NULL);
|
||||||
|
|
||||||
private = g_new (GdkFontPrivate, 1);
|
private = g_new (GdkFontPrivate, 1);
|
||||||
font = (GdkFont*) private;
|
font = (GdkFont*) private;
|
||||||
|
|
||||||
|
@ -186,7 +186,6 @@ gdk_wcstombs (const GdkWChar *src)
|
|||||||
}
|
}
|
||||||
mbstr[mbsl] = '\0';
|
mbstr[mbsl] = '\0';
|
||||||
g_free (src_alt);
|
g_free (src_alt);
|
||||||
return mbstr;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -233,6 +232,7 @@ gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
|
|||||||
wcsl = dest_max;
|
wcsl = dest_max;
|
||||||
for (i = 0; i < wcsl; i++)
|
for (i = 0; i < wcsl; i++)
|
||||||
dest[i] = wcstr[i];
|
dest[i] = wcstr[i];
|
||||||
|
g_free (wcstr);
|
||||||
|
|
||||||
return wcsl;
|
return wcsl;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,6 @@ gdk_wcstombs (const GdkWChar *src)
|
|||||||
}
|
}
|
||||||
mbstr[mbsl] = '\0';
|
mbstr[mbsl] = '\0';
|
||||||
g_free (src_alt);
|
g_free (src_alt);
|
||||||
return mbstr;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -233,6 +232,7 @@ gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
|
|||||||
wcsl = dest_max;
|
wcsl = dest_max;
|
||||||
for (i = 0; i < wcsl; i++)
|
for (i = 0; i < wcsl; i++)
|
||||||
dest[i] = wcstr[i];
|
dest[i] = wcstr[i];
|
||||||
|
g_free (wcstr);
|
||||||
|
|
||||||
return wcsl;
|
return wcsl;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user