Avoid crash on invalid file name.
authorjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 23 Jan 2010 12:29:57 +0000 (12:29 +0000)
committerjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 23 Jan 2010 12:29:57 +0000 (12:29 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@31632 f5534014-38df-0310-8fa8-9805f1628bb7

capinfos.c

index f3c0fdb5f4a12ce0c16a8a60b8e82080e884af53..9dded9bda554462804dd755e7784901ecf4a596a 100644 (file)
@@ -880,8 +880,8 @@ main(int argc, char *argv[])
         hash_to_str(gcry_md_read(hd, GCRY_MD_RMD160), HASH_SIZE_RMD160, file_rmd160);
         hash_to_str(gcry_md_read(hd, GCRY_MD_MD5), HASH_SIZE_MD5, file_md5);
       }
-      fclose(fh);
-      gcry_md_reset(hd);
+      if (fh) fclose(fh);
+      if (hd) gcry_md_reset(hd);
     }
 #endif /* HAVE_LIBGCRYPT */