Fixed few memory leaks

This commit is contained in:
Yevgen Muntyan 2010-12-14 23:53:27 -08:00
parent aff6e179ab
commit 1a804a7f80
4 changed files with 54 additions and 3 deletions

View File

@ -100,11 +100,14 @@ normalize_encoding (const char *encoding,
gboolean
_moo_edit_file_is_new (GFile *file)
{
gboolean is_new;
char *filename;
moo_return_val_if_fail (G_IS_FILE (file), FALSE);
filename = g_file_get_path (file);
moo_return_val_if_fail (filename != NULL, FALSE);
return !g_file_test (filename, G_FILE_TEST_EXISTS);
is_new = !g_file_test (filename, G_FILE_TEST_EXISTS);
g_free (filename);
return is_new;
}
@ -931,6 +934,7 @@ do_save_local (MooEdit *edit,
{
to_save = encoded;
to_save_size = bytes_written;
freeme = encoded;
}
else
{

View File

@ -17,6 +17,7 @@ moo_file_fnmatch (GFile *file,
const char *glob)
{
char *filename;
gboolean ret;
moo_return_val_if_fail (G_IS_FILE (file), FALSE);
moo_return_val_if_fail (glob != NULL, FALSE);
@ -24,5 +25,8 @@ moo_file_fnmatch (GFile *file,
filename = g_file_get_path (file);
moo_return_val_if_fail (filename != NULL, FALSE);
return fnmatch (glob, filename, 0) == 0;
ret = fnmatch (glob, filename, 0) == 0;
g_free (filename);
return ret;
}

View File

@ -1969,11 +1969,13 @@ moo_log_debug_enabled (void)
void _moo_logv (MooCodeLoc loc, GLogLevelFlags flags, const char *format, va_list args)
{
char *message = g_strdup_vprintf (format, args);
char *message;
if (flags >= G_LOG_LEVEL_DEBUG && !moo_log_debug_enabled ())
return;
message = g_strdup_vprintf (format, args);
#if defined(MOO_DEV_MODE) && !defined(__WIN32__)
if (flags < G_LOG_LEVEL_MESSAGE)
{

View File

@ -210,3 +210,44 @@
obj:/usr/lib/libgobject-2.0.so*
fun:g_type_register_static
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:g_utf8_pointer_to_offset
fun:g_utf8_pointer_to_offset
fun:regex_fetch_pos
fun:apply_sub_patterns
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
fun:malloc
fun:_XEnq
obj:/usr/lib/libX11.so.6.3.0
fun:_XReadEvents
fun:XIfEvent
fun:gdk_x11_get_server_time
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:gtk_rc_parse_string
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:gtk_rc_get_style
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
...
fun:gdk_window_focus
}