Hi all,
I found three instances of code like:
if (ptr)
g_free(ptr);
The test nefore g_free is completely unneessary.
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
# Subject: Don't test if pointer is non-NULL before g_free.
# Author: Erik de Castro Lopo <[email protected]>
# Forwarded: yes
# Last-Update: 2010-09-09
=== modified file 'src/encodings.c'
--- geany-bzr.orig/src/encodings.c 2010-08-25 11:44:33 +0000
+++ geany-bzr/src/encodings.c 2010-09-09 05:21:54 +0000
@@ -488,8 +488,7 @@
geany_debug("Couldn't convert from %s to UTF-8.", charset);
utf8_content = NULL;
- if (converted_contents != NULL)
- g_free(converted_contents);
+ g_free(converted_contents);
}
else
{
=== modified file 'src/highlighting.c'
--- geany-bzr.orig/src/highlighting.c 2010-08-23 12:14:58 +0000
+++ geany-bzr/src/highlighting.c 2010-09-09 05:22:12 +0000
@@ -436,8 +436,7 @@
if (named_style_hash)
g_hash_table_destroy(named_style_hash);
- if (style_sets)
- g_free(style_sets);
+ g_free(style_sets);
}
=== modified file 'tagmanager/tm_file_entry.c'
--- geany-bzr.orig/tagmanager/tm_file_entry.c 2008-10-22 14:36:16 +0000
+++ geany-bzr/tagmanager/tm_file_entry.c 2010-09-09 05:20:46 +0000
@@ -238,8 +238,7 @@
}
closedir(dir);
entry->children = g_slist_sort(entry->children, (GCompareFunc) tm_file_entry_compare);
- if (entries)
- g_free(entries);
+ g_free(entries);
break;
}
return entry;
@@ -257,8 +256,7 @@
tm_file_entry_free(tmp->data);
g_slist_free(file_entry->children);
}
- if (file_entry->version)
- g_free(file_entry->version);
+ g_free(file_entry->version);
g_free(file_entry->path);
FILE_FREE(file_entry);
}
_______________________________________________
Geany-devel mailing list
[email protected]
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel