When passing NULL to utils_str_replace(), also return NULL (fixes broken new file template list).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3241 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2008-11-16 17:55:23 +00:00
parent 79ed7d7604
commit 614fdbd0a7
2 changed files with 9 additions and 1 deletions

View File

@ -20,6 +20,9 @@
to indicators for more consistency.
* src/templates.c:
Plug little memory leak.
* src/utils.c:
When passing NULL to utils_str_replace(), also return NULL
(fixes broken new file template list).
2008-11-15 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -504,7 +504,12 @@ gint utils_is_file_writeable(const gchar *locale_filename)
* See utils_string_replace_all() for details. */
gchar *utils_str_replace(gchar *haystack, const gchar *needle, const gchar *replacement)
{
GString *str = g_string_new(haystack);
GString *str;
if (haystack == NULL)
return NULL;
str = g_string_new(haystack);
g_free(haystack);
utils_string_replace_all(str, needle, replacement);