Protect against nullptr dereference, remove unused GError.

Found by clang static analyzer.
This commit is contained in:
John Ralls 2018-11-28 16:18:34 +09:00
parent 24ce92056d
commit 876bfd19ad
2 changed files with 3 additions and 4 deletions

View File

@ -1539,7 +1539,6 @@ try_gz_open (const char* filename, const char* perms, gboolean use_gzip,
{
int filedes[2];
GThread* thread;
GError* error = NULL;
gz_thread_params_t* params;
FILE* file;
@ -1564,9 +1563,7 @@ try_gz_open (const char* filename, const char* perms, gboolean use_gzip,
params);
if (!thread)
{
g_warning ("Could not create thread for (de)compression: %s",
error->message);
g_error_free (error);
g_warning ("Could not create thread for (de)compression.");
g_free (params->filename);
g_free (params->perms);
g_free (params);

View File

@ -65,6 +65,8 @@ write_one_account (FILE* out,
xmlElemDump (out, NULL, accnode);
xmlFreeNode (accnode);
g_return_val_if_fail(gd, FALSE);
if (ferror (out) || fprintf (out, "\n") < 0)
return FALSE;