Check for NULL parameter in gdk_font_load. Plug a memory leak in gdkim.c.

This commit is contained in:
Tor Lillqvist 1999-03-12 20:12:58 +00:00
parent 0c178e965c
commit 700891684e
4 changed files with 6 additions and 2 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}