diff options
author | Havoc Pennington <hp@pobox.com> | 2000-11-05 17:02:37 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2000-11-05 17:02:37 +0000 |
commit | d4ff0ef999bb819085a2b060a79e41eecd5fce63 (patch) | |
tree | ad825bd6a5b29cc5193b0bc21b55b8bcff17bcda /gerror.c | |
parent | 110c6cbac8d9cbddc27dcdf3f6c22889262fcc54 (diff) | |
download | glib-d4ff0ef999bb819085a2b060a79e41eecd5fce63.tar.gz |
Free the src error if the dest location is NULL - I'm pretty sure that's
2000-11-05 Havoc Pennington <hp@pobox.com>
* gerror.c (g_propagate_error): Free the src error if the dest
location is NULL - I'm pretty sure that's what this function was
supposed to do.
2000-11-05 Havoc Pennington <hp@pobox.com>
* glib/tmpl/error_reporting.sgml: fixes
Diffstat (limited to 'gerror.c')
-rw-r--r-- | gerror.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -207,7 +207,7 @@ g_set_error (GError **err, * @dest: error return location * @src: error to move into the return location * - * Does nothing if @dest is NULL; otherwise, + * If @dest is NULL, free @src; otherwise, * moves @src into *@dest. *@dest must be NULL. **/ void @@ -215,14 +215,20 @@ g_propagate_error (GError **dest, GError *src) { g_return_if_fail (src != NULL); - - if (dest == NULL) - return; - if (*dest != NULL) - g_warning (ERROR_OVERWRITTEN_WARNING); - - *dest = src; + if (dest == NULL) + { + if (src) + g_error_free (src); + return; + } + else + { + if (*dest != NULL) + g_warning (ERROR_OVERWRITTEN_WARNING); + + *dest = src; + } } /** |