* @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
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;
+ }
}
/**