summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRocco Rutte <pdmef@gmx.net>2009-03-15 13:46:52 +0100
committerRocco Rutte <pdmef@gmx.net>2009-03-15 13:46:52 +0100
commit8cfd92192fbe9b2c17fdc2b262592a486025d0ff (patch)
tree6fa88dcb48254bd3d5a6492eb7889671482592db
parent06d425398e3ef6fd3b152d95f6def1b4b14ff43e (diff)
Use safe_fclose() instead of fclose(), add fclose() to check_sec.sh
-rw-r--r--ChangeLog4
-rw-r--r--alias.c4
-rw-r--r--attach.c14
-rw-r--r--buffy.c2
-rwxr-xr-xcheck_sec.sh1
-rw-r--r--commands.c2
-rw-r--r--compose.c2
-rw-r--r--copy.c4
-rw-r--r--crypt-gpgme.c33
-rw-r--r--crypt.c6
-rw-r--r--edit.c2
-rw-r--r--editmsg.c2
-rw-r--r--gnupgparse.c2
-rw-r--r--handler.c4
-rw-r--r--headers.c10
-rw-r--r--help.c2
-rw-r--r--history.c10
-rw-r--r--imap/message.c10
-rw-r--r--init.c4
-rw-r--r--lib.c7
-rw-r--r--main.c6
-rw-r--r--mbox.c4
-rw-r--r--mh.c2
-rw-r--r--mutt_ssl.c6
-rw-r--r--mutt_ssl_gnutls.c8
-rw-r--r--muttlib.c2
-rw-r--r--pager.c4
-rw-r--r--pattern.c4
-rw-r--r--pgp.c68
-rw-r--r--pgpkey.c20
-rw-r--r--pgppubring.c2
-rw-r--r--pop.c2
-rw-r--r--postpone.c2
-rw-r--r--query.c2
-rw-r--r--recvattach.c14
-rw-r--r--recvcmd.c10
-rw-r--r--rfc1524.c8
-rw-r--r--rfc3676.c6
-rw-r--r--send.c4
-rw-r--r--sendlib.c16
-rw-r--r--smime.c122
-rw-r--r--smtp.c10
42 files changed, 224 insertions, 223 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d89f175..442798f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-03-10 18:39 +0100 NONAKA Kimihiro <nonakap@gmail.com> (cc6fede605d4)
+
+ * ChangeLog, mh.c: Fix crashes with 64bit time_t. Closes #3184.
+
2009-03-09 12:04 +0100 Vincent Lefevre <vincent@vinc17.org> (4ce562b7f5d7)
* mbyte.h: Unbreak compilation on OS X with --with-regex/--without-wc-
diff --git a/alias.c b/alias.c
index 9128372f..1de2bf4e 100644
--- a/alias.c
+++ b/alias.c
@@ -378,7 +378,7 @@ retry_name:
recode_buf (buf, sizeof (buf));
write_safe_address (rc, buf);
fputc ('\n', rc);
- fclose (rc);
+ safe_fclose (&rc);
mutt_message _("Alias added.");
}
else
@@ -388,7 +388,7 @@ retry_name:
fseek_err:
mutt_perror (_("Error seeking in alias file"));
- fclose(rc);
+ safe_fclose (&rc);
return;
}
diff --git a/attach.c b/attach.c
index 5acc17b3..9e99e924 100644
--- a/attach.c
+++ b/attach.c
@@ -76,8 +76,8 @@ int mutt_get_tmp_attachment (BODY *a)
else
mutt_perror(fpin ? tempfile : a->filename);
- if(fpin) fclose(fpin);
- if(fpout) fclose(fpout);
+ if(fpin) safe_fclose (&fpin);
+ if(fpout) safe_fclose (&fpout);
return a->unlink ? 0 : -1;
}
@@ -176,8 +176,8 @@ int mutt_compose_attachment (BODY *a)
goto bailout;
}
mutt_copy_stream (fp, tfp);
- fclose (fp);
- fclose (tfp);
+ safe_fclose (&fp);
+ safe_fclose (&tfp);
mutt_unlink (a->filename);
if (mutt_rename_file (tempfile, a->filename) != 0)
{
@@ -884,7 +884,7 @@ int mutt_decode_save_attachment (FILE *fp, BODY *m, char *path,
if (stat (m->filename, &st) == -1)
{
mutt_perror ("stat");
- fclose (s.fpout);
+ safe_fclose (&s.fpout);
return (-1);
}
@@ -915,7 +915,7 @@ int mutt_decode_save_attachment (FILE *fp, BODY *m, char *path,
mutt_body_handler (m, &s);
- fclose (s.fpout);
+ safe_fclose (&s.fpout);
if (fp == NULL)
{
m->length = 0;
@@ -926,7 +926,7 @@ int mutt_decode_save_attachment (FILE *fp, BODY *m, char *path,
m->parts = saved_parts;
m->hdr = saved_hdr;
}
- fclose (s.fpin);
+ safe_fclose (&s.fpin);
}
return (0);
diff --git a/buffy.c b/buffy.c
index db20c218..c5578504 100644
--- a/buffy.c
+++ b/buffy.c
@@ -128,7 +128,7 @@ static int test_new_folder (const char *path)
if ((f = fopen (path, "rb")))
{
rc = test_last_status_new (f);
- fclose (f);
+ safe_fclose (&f);
}
return rc;
diff --git a/check_sec.sh b/check_sec.sh
index f8a73e5c..c4505a3a 100755
--- a/check_sec.sh
+++ b/check_sec.sh
@@ -31,6 +31,7 @@ do_check ()
}
do_check '\<fopen.*'\"'.*w' __FOPEN_CHECKED__ "Alert: Unchecked fopen calls."
+do_check '\<fclose.*'\"'.*w' __FCLOSE_CHECKED__ "Alert: Unchecked fclose calls."
do_check '\<(mutt_)?strcpy' __STRCPY_CHECKED__ "Alert: Unchecked strcpy calls."
do_check '\<strcat' __STRCAT_CHECKED__ "Alert: Unchecked strcat calls."
do_check '\<sprintf.*%s' __SPRINTF_CHECKED__ "Alert: Unchecked sprintf calls."
diff --git a/commands.c b/commands.c
index 45b9db76..35707954 100644
--- a/commands.c
+++ b/commands.c
@@ -391,7 +391,7 @@ static int _mutt_pipe_message (HEADER *h, char *cmd,
}
pipe_msg (h, fpout, decode, print);
- fclose (fpout);
+ safe_fclose (&fpout);
rc = mutt_wait_filter (thepid);
}
else
diff --git a/compose.c b/compose.c
index 28296460..d500f07e 100644
--- a/compose.c
+++ b/compose.c
@@ -1073,7 +1073,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
FREE (&idx[idxlen]);
continue;
}
- fclose (fp);
+ safe_fclose (&fp);
if ((idx[idxlen]->content = mutt_make_file_attach (fname)) == NULL)
{
diff --git a/copy.c b/copy.c
index fa283200..95e12aed 100644
--- a/copy.c
+++ b/copy.c
@@ -633,12 +633,12 @@ _mutt_copy_message (FILE *fpout, FILE *fpin, HEADER *hdr, BODY *body,
fseeko (fp, cur->offset, 0);
if (mutt_copy_bytes (fp, fpout, cur->length) == -1)
{
- fclose (fp);
+ safe_fclose (&fp);
mutt_free_body (&cur);
return (-1);
}
mutt_free_body (&cur);
- fclose (fp);
+ safe_fclose (&fp);
}
else
{
diff --git a/crypt-gpgme.c b/crypt-gpgme.c
index 8aac3dda..244293f5 100644
--- a/crypt-gpgme.c
+++ b/crypt-gpgme.c
@@ -440,12 +440,12 @@ static gpgme_data_t body_to_data_object (BODY *a, int convert)
buf[0] = c;
gpgme_data_write (data, buf, 1);
}
- fclose(fptmp);
+ safe_fclose (&fptmp);
gpgme_data_seek (data, 0, SEEK_SET);
}
else
{
- fclose(fptmp);
+ safe_fclose (&fptmp);
err = gpgme_data_new_from_file (&data, tempfile, 1);
}
unlink (tempfile);
@@ -544,7 +544,7 @@ static char *data_object_to_tempfile (gpgme_data_t data, FILE **ret_fp)
if (fwrite (buf, nread, 1, fp) != 1)
{
mutt_perror (tempfile);
- fclose (fp);
+ safe_fclose (&fp);
unlink (tempfile);
return NULL;
}
@@ -553,12 +553,12 @@ static char *data_object_to_tempfile (gpgme_data_t data, FILE **ret_fp)
if (ret_fp)
rewind (fp);
else
- fclose (fp);
+ safe_fclose (&fp);
if (nread == -1)
{
mutt_error (_("error reading data object: %s\n"), gpgme_strerror (err));
unlink (tempfile);
- fclose (fp);
+ safe_fclose (&fp);
return NULL;
}
if (ret_fp)
@@ -1788,7 +1788,7 @@ int smime_gpgme_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
b->type = saved_b_type;
b->length = saved_b_length;
b->offset = saved_b_offset;
- fclose (tmpfp);
+ safe_fclose (&tmpfp);
rewind (*fpout);
if (*cur && !is_signed && !(*cur)->parts && mutt_is_application_smime (*cur))
{
@@ -1824,7 +1824,7 @@ int smime_gpgme_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
bb->length = ftello (s.fpout);
bb->offset = 0;
rewind (tmpfp);
- fclose (*fpout);
+ safe_fclose (fpout);
memset (&s, 0, sizeof (s));
s.fpin = tmpfp;
@@ -1843,7 +1843,7 @@ int smime_gpgme_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
bb->type = saved_b_type;
bb->length = saved_b_length;
bb->offset = saved_b_offset;
- fclose (tmpfp);
+ safe_fclose (&tmpfp);
rewind (*fpout);
mutt_free_body (cur);
*cur = tmp_b;
@@ -1956,10 +1956,7 @@ static int pgp_gpgme_extract_keys (gpgme_data_t keydata, FILE** fp, int dryrun)
err_fp:
if (rc)
- {
- fclose (*fp);
- *fp = NULL;
- }
+ safe_fclose (fp);
err_tmpdir:
if (dryrun)
mutt_rmtree (tmpdir);
@@ -2068,7 +2065,7 @@ void pgp_gpgme_invoke_import (const char *fname)
dprint (1, (debugfile, "error converting key file into data object\n"));
return;
}
- fclose (in);
+ safe_fclose (&in);
if (!pgp_gpgme_extract_keys (keydata, &out, 0))
{
@@ -2076,7 +2073,7 @@ void pgp_gpgme_invoke_import (const char *fname)
outlen = ftell (out);
fseek (out, 0, SEEK_SET);
mutt_copy_bytes (out, stdout, outlen);
- fclose (out);
+ safe_fclose (&out);
}
else
printf (_("Error extracting key data!\n"));
@@ -2150,7 +2147,7 @@ static void copy_clearsigned (gpgme_data_t data, STATE *s, char *charset)
}
fgetconv_close (&fc);
- fclose (fp);
+ safe_fclose (&fp);
}
@@ -2476,7 +2473,7 @@ int pgp_gpgme_encrypted_handler (BODY *a, STATE *s)
mutt_free_body (&tattach);
}
- fclose (fpout);
+ safe_fclose (&fpout);
mutt_unlink(tempfile);
dprint (2, (debugfile, "Leaving pgp_encrypted handler\n"));
@@ -2550,7 +2547,7 @@ int smime_gpgme_application_handler (BODY *a, STATE *s)
mutt_free_body (&tattach);
}
- fclose (fpout);
+ safe_fclose (&fpout);
mutt_unlink(tempfile);
dprint (2, (debugfile, "Leaving smime_encrypted handler\n"));
@@ -3506,7 +3503,7 @@ verify_key (crypt_key_t *key)
leave:
gpgme_key_release (k);
gpgme_release (listctx);
- fclose (fp);
+ safe_fclose (&fp);
mutt_clear_error ();
snprintf (cmd, sizeof (cmd), _("Key ID: 0x%s"), crypt_keyid (key));
mutt_do_pager (cmd, tempfile, 0, NULL);
diff --git a/crypt.c b/crypt.c
index eb2c3e01..60b594d0 100644
--- a/crypt.c
+++ b/crypt.c
@@ -538,7 +538,7 @@ int crypt_write_signed(BODY *a, STATE *s, const char *tempfile)
fputc (c, fp);
}
- fclose (fp);
+ safe_fclose (&fp);
return 0;
}
@@ -613,7 +613,7 @@ void crypt_extract_keys_from_messages (HEADER * h)
if (Context->hdrs[Context->v2r[i]]->security & ENCRYPT &&
!crypt_valid_passphrase (Context->hdrs[Context->v2r[i]]->security))
{
- fclose (fpout);
+ safe_fclose (&fpout);
break;
}
@@ -695,7 +695,7 @@ void crypt_extract_keys_from_messages (HEADER * h)
}
}
- fclose (fpout);
+ safe_fclose (&fpout);
if (isendwin())
mutt_any_key_to_continue (NULL);
diff --git a/edit.c b/edit.c
index d952e9a2..35e45e47 100644
--- a/edit.c
+++ b/edit.c
@@ -109,7 +109,7 @@ be_snarf_file (const char *path, char **buf, int *max, int *len, int verbose)
snprintf(tmp, sizeof(tmp), "\"%s\" %lu bytes\n", path, (unsigned long) sb.st_size);
addstr(tmp);
}
- fclose (f);
+ safe_fclose (&f);
}
else
{
diff --git a/editmsg.c b/editmsg.c
index 85b75e31..ecba7544 100644
--- a/editmsg.c
+++ b/editmsg.c
@@ -191,7 +191,7 @@ static int edit_one_message (CONTEXT *ctx, HEADER *cur)
mx_close_mailbox (&tmpctx, NULL);
bail:
- if (fp) fclose (fp);
+ if (fp) safe_fclose (&fp);
if (rc >= 0)
unlink (tmp);
diff --git a/gnupgparse.c b/gnupgparse.c
index 0bfb1983..b7740d50 100644
--- a/gnupgparse.c
+++ b/gnupgparse.c
@@ -373,7 +373,7 @@ pgp_key_t pgp_get_candidates (pgp_ring_t keyring, LIST * hints)
if (ferror (fp))
mutt_perror ("fgets");
- fclose (fp);
+ safe_fclose (&fp);
mutt_wait_filter (thepid);
close (devnull);
diff --git a/handler.c b/handler.c
index 508aec47..c3572bd3 100644
--- a/handler.c
+++ b/handler.c
@@ -1643,7 +1643,7 @@ int mutt_body_handler (BODY *b, STATE *s)
{
b->length = ftello (s->fpout);
b->offset = 0;
- fclose (s->fpout);
+ safe_fclose (&s->fpout);
/* restore final destination and substitute the tempfile for input */
s->fpout = fp;
@@ -1674,7 +1674,7 @@ int mutt_body_handler (BODY *b, STATE *s)
b->offset = tmpoffset;
/* restore the original source stream */
- fclose (s->fpin);
+ safe_fclose (&s->fpin);
s->fpin = fp;
}
}
diff --git a/headers.c b/headers.c
index 8d4a3aa5..7a102b05 100644
--- a/headers.c
+++ b/headers.c
@@ -64,8 +64,8 @@ void mutt_edit_headers (const char *editor,
mutt_copy_stream (ifp, ofp);
- fclose (ifp);
- fclose (ofp);
+ safe_fclose (&ifp);
+ safe_fclose (&ofp);
if (stat (path, &st) == -1)
{
@@ -98,7 +98,7 @@ void mutt_edit_headers (const char *editor,
if ((ofp = safe_fopen (body, "w")) == NULL)
{
/* intentionally leak a possible temporary file here */
- fclose (ifp);
+ safe_fclose (&ifp);
mutt_perror (body);
return;
}
@@ -106,8 +106,8 @@ void mutt_edit_headers (const char *editor,
n = mutt_read_rfc822_header (ifp, NULL, 1, 0);
while ((i = fread (buffer, 1, sizeof (buffer), ifp)) > 0)
fwrite (buffer, 1, i, ofp);
- fclose (ofp);
- fclose (ifp);
+ safe_fclose (&ofp);
+ safe_fclose (&ifp);
mutt_unlink (path);
/* restore old info. */
diff --git a/help.c b/help.c
index b0d50f6f..10ad9cf2 100644
--- a/help.c
+++ b/help.c
@@ -367,7 +367,7 @@ void mutt_help (int menu)
if (menu != MENU_PAGER)
dump_unbound (f, OpGeneric, Keymaps[MENU_GENERIC], Keymaps[menu]);
- fclose (f);
+ safe_fclose (&f);
snprintf (buf, sizeof (buf), _("Help for %s"), desc);
}
diff --git a/history.c b/history.c
index f8702d45..6585aa33 100644
--- a/history.c
+++ b/history.c
@@ -90,7 +90,7 @@ void mutt_read_histfile (void)
}
}
- fclose (f);
+ safe_fclose (&f);
FREE (&linebuf);
}
@@ -149,7 +149,7 @@ static void shrink_histfile (void)
}
cleanup:
- fclose (f);
+ safe_fclose (&f);
FREE (&linebuf);
if (tmp != NULL)
{
@@ -158,9 +158,9 @@ cleanup:
{
rewind (tmp);
mutt_copy_stream (tmp, f);
- fclose (f);
+ safe_fclose (&f);
}
- fclose (tmp);
+ safe_fclose (&tmp);
unlink (tmpfname);
}
}
@@ -196,7 +196,7 @@ static void save_history (history_class_t hclass, const char *s)
}
fputs ("|\n", f);
- fclose (f);
+ safe_fclose (&f);
FREE (&tmp);
if (--n < 0)
diff --git a/imap/message.c b/imap/message.c
index 5bcd6fb7..32d794e6 100644
--- a/imap/message.c
+++ b/imap/message.c
@@ -220,7 +220,7 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend)
if (h.data)
imap_free_header_data ((void**) (void*) &h.data);
imap_hcache_close (idata);
- fclose (fp);
+ safe_fclose (&fp);
return -1;
}
}
@@ -331,7 +331,7 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend)
#if USE_HCACHE
imap_hcache_close (idata);
#endif
- fclose (fp);
+ safe_fclose (&fp);
return -1;
}
@@ -364,7 +364,7 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend)
imap_hcache_close (idata);
#endif /* USE_HCACHE */
- fclose(fp);
+ safe_fclose (&fp);
if (ctx->msgcount > oldmsgcount)
{
@@ -654,7 +654,7 @@ int imap_append_message (CONTEXT *ctx, MESSAGE *msg)
pc = imap_next_word (pc);
mutt_error ("%s", pc);
mutt_sleep (1);
- fclose (fp);
+ safe_fclose (&fp);
goto fail;
}
@@ -677,7 +677,7 @@ int imap_append_message (CONTEXT *ctx, MESSAGE *msg)
flush_buffer(buf, &len, idata->conn);
mutt_socket_write (idata->conn, "\r\n");
- fclose (fp);
+ safe_fclose (&fp);
do
rc = imap_cmd_step (idata);
diff --git a/init.c b/init.c
index 199a7f0b..f66d551b 100644
--- a/init.c
+++ b/init.c
@@ -254,7 +254,7 @@ int mutt_extract_token (BUFFER *dest, BUFFER *tok, int flags)
/* read line */
memset (&expn, 0, sizeof (expn));
expn.data = mutt_read_line (NULL, &expn.dsize, fp, &line);
- fclose (fp);
+ safe_fclose (&fp);
mutt_wait_filter (pid);
/* if we got output, make a new string consiting of the shell ouptput
@@ -2299,7 +2299,7 @@ static int source_rc (const char *rcfile, BUFFER *err)
}
FREE (&token.data);
FREE (&linebuf);
- fclose (f);
+ safe_fclose (&f);
if (pid != -1)
mutt_wait_filter (pid);
if (rc)
diff --git a/lib.c b/lib.c
index 146f363f..ed5daed2 100644
--- a/lib.c
+++ b/lib.c
@@ -220,11 +220,10 @@ int safe_fsync_close (FILE **f)
if (fflush (*f) || fsync (fileno (*f)))
{
r = -1;
- fclose (*f);
+ safe_fclose (f);
}
else
- r = fclose(*f);
- *f = NULL;
+ r = safe_fclose (f);
}
return r;
@@ -345,7 +344,7 @@ void mutt_unlink (const char *s)
fwrite (buf, 1, MIN (sizeof (buf), sb.st_size), f);
sb.st_size -= MIN (sizeof (buf), sb.st_size);
}
- fclose (f);
+ safe_fclose (&f);
}
}
}
diff --git a/main.c b/main.c
index b984d704..d4023ed3 100644
--- a/main.c
+++ b/main.c
@@ -909,7 +909,7 @@ int main (int argc, char **argv)
if (!option (OPTNOCURSES))
mutt_endwin (NULL);
perror (tempfile);
- fclose (fin);
+ safe_fclose (&fin);
FREE (&tempfile);
exit (1);
}
@@ -917,9 +917,9 @@ int main (int argc, char **argv)
mutt_copy_stream (fin, fout);
else if (bodytext)
fputs (bodytext, fout);
- fclose (fout);
+ safe_fclose (&fout);
if (fin && fin != stdin)
- fclose (fin);
+ safe_fclose (&fin);
}
}
diff --git a/mbox.c b/mbox.c
index ec3a02ff..844da877 100644
--- a/mbox.c
+++ b/mbox.c
@@ -877,7 +877,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
if (fclose (fp) != 0)
{
fp = NULL;
- dprint(1, (debugfile, "mbox_sync_mailbox: fclose() returned non-zero.\n"));
+ dprint(1, (debugfile, "mbox_sync_mailbox: safe_fclose (&) returned non-zero.\n"));
unlink (tempfile);
mutt_perror (tempfile);
mutt_sleep (5);
@@ -939,7 +939,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
}
}
- fclose (fp);
+ safe_fclose (&fp);
fp = NULL;
mbox_unlock_mailbox (ctx);
diff --git a/mh.c b/mh.c
index e795a02f..e2c5b695 100644
--- a/mh.c
+++ b/mh.c
@@ -637,7 +637,7 @@ static HEADER *maildir_parse_message (int magic, const char *fname,
h->env = mutt_read_rfc822_header (f, h, 0, 0);
fstat (fileno (f), &st);
- fclose (f);
+ safe_fclose (&f);
if (!h->received)
h->received = h->date_sent;
diff --git a/mutt_ssl.c b/mutt_ssl.c
index 7cf5371d..04e9a44c 100644
--- a/mutt_ssl.c
+++ b/mutt_ssl.c
@@ -587,7 +587,7 @@ static int check_certificate_by_digest (X509 *peercert)
if (!X509_digest (peercert, EVP_sha1(), peermd, &peermdlen))
{
- fclose (fp);
+ safe_fclose (&fp);
return 0;
}
@@ -599,7 +599,7 @@ static int check_certificate_by_digest (X509 *peercert)
break;
}
X509_free (cert);
- fclose (fp);
+ safe_fclose (&fp);
return pass;
}
@@ -925,7 +925,7 @@ static int interactive_check_cert (X509 *cert, int idx, int len)
{
if (PEM_write_X509 (fp, cert))
done = 1;
- fclose (fp);
+ safe_fclose (&fp);
}
if (!done)
{
diff --git a/mutt_ssl_gnutls.c b/mutt_ssl_gnutls.c
index 958d0544..0895b66d 100644
--- a/mutt_ssl_gnutls.c
+++ b/mutt_ssl_gnutls.c
@@ -417,7 +417,7 @@ static int tls_compare_certificates (const gnutls_datum *peercert)
}
b64_data.size = fread(b64_data.data, 1, b64_data.size, fd1);
- fclose(fd1);
+ safe_fclose (&fd1);
do {
ret = gnutls_pem_base64_decode_alloc(NULL, &b64_data, &cert);
@@ -526,7 +526,7 @@ static int tls_check_stored_hostname (const gnutls_datum *cert,
{
regfree(&preg);
FREE(&linestr);
- fclose(fp);
+ safe_fclose (&fp);
return 1;
}
}
@@ -534,7 +534,7 @@ static int tls_check_stored_hostname (const gnutls_datum *cert,
}
regfree(&preg);
- fclose(fp);
+ safe_fclose (&fp);
}
/* not found a matching name */
@@ -877,7 +877,7 @@ static int tls_check_one_certificate (const gnutls_datum_t *certdata,
gnutls_free (pemdata.data);
}
}
- fclose (fp);
+ safe_fclose (&fp);
}
if (!done)
{
diff --git a/muttlib.c b/muttlib.c
index d1ce40c0..f8f99bec 100644
--- a/muttlib.c
+++ b/muttlib.c
@@ -1093,7 +1093,7 @@ void mutt_FormatString (char *dest, /* output buffer */
if ((pid = mutt_create_filter(command->data, NULL, &filter, NULL)))
{
n = fread(dest, 1, destlen /* already decremented */, filter);
- fclose(filter);
+ safe_fclose (&filter);
dest[n] = '\0';
while (dest[n-1] == '\n' || dest[n-1] == '\r')
dest[--n] = '\0';
diff --git a/pager.c b/pager.c
index 8f8a92b5..38f2e9e5 100644
--- a/pager.c
+++ b/pager.c
@@ -1542,7 +1542,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
if (stat (fname, &sb) != 0)
{
mutt_perror (fname);
- fclose (fp);
+ safe_fclose (&fp);
return (-1);
}
unlink (fname);
@@ -2677,7 +2677,7 @@ search_next:
}
}
- fclose (fp);
+ safe_fclose (&fp);
if (IsHeader (extra))
{
Context->msgnotreadyet = -1;
diff --git a/pattern.c b/pattern.c
index b092de86..e693c02f 100644
--- a/pattern.c
+++ b/pattern.c
@@ -182,7 +182,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno)
mx_close_message (&msg);
if (s.fpout)
{
- fclose (s.fpout);
+ safe_fclose (&s.fpout);
unlink (tempfile);
}
return (0);
@@ -242,7 +242,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno)
if (option (OPTTHOROUGHSRC))
{
- fclose (fp);
+ safe_fclose (&fp);
unlink (tempfile);
}
}
diff --git a/pgp.c b/pgp.c
index 32018e97..8835d9ae 100644
--- a/pgp.c
+++ b/pgp.c
@@ -605,7 +605,7 @@ int pgp_verify_one (BODY *sigbdy, STATE *s, const char *tempfile)
fseeko (s->fpin, sigbdy->offset,