g10: Fix uninitalized variable use in sign_file

* g10/sign.c (sign_file): Initialize gcry_md_hd_t to NULL.

--
There are several jumps to leave before gcry_md_open is called so
md should be initialized to NULL to avoid calling gcry_md_close
on an uninitalized variable.

GnuPG-Bug-Id: T6780
This commit is contained in:
Andre Heinecke 2023-10-28 14:20:31 +02:00
parent 16b6b77532
commit 05ef8c0cc0
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C
1 changed files with 1 additions and 1 deletions

View File

@ -1020,7 +1020,7 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr,
const char *fname;
armor_filter_context_t *afx;
compress_filter_context_t zfx;
gcry_md_hd_t md;
gcry_md_hd_t md = NULL;
md_filter_context_t mfx;
md_thd_filter_context_t mfx2 = NULL;
text_filter_context_t tfx;