Wireshark-commits: [Wireshark-commits] master-2.0 9d4080b: ssl-utils: simplify private key storage,

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Wed, 7 Oct 2015 06:48:48 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=9d4080b62cf4b9fe1556505d93331bf882d855ae
Submitter: Anders Broman (a.broman58@xxxxxxxxx)
Changed: branch: master-2.0
Repository: wireshark

Commits:

9d4080b by Peter Wu (peter@xxxxxxxxxxxxx):

    ssl-utils: simplify private key storage, fix resource leaks
    
    The certificate and GnuTLS private key are never used except for
    reporting in the log file. Remove the unused certificate-related code
    from the PKCS#12 file parsing. Report an immediate error instead of
    opening key file if GnuTLS is disabled.
    
    Made ssl_load_key and ssl_load_pkcs12 static, they are not used outside
    the SSL dissector. If for some reason the PKCS#12 bag contains multiple
    private keys, then the previous one would be overwritten (leaking
    memory). Fix this by returning the first private key found.
    
    Simplify key_hash (dtls_key_hash/ssl_key_hash) memory management, now
    the table automatically frees keys/values when items are removed.
    
    Fix memory leaks:
     - ssldecrypt_uat_fld_password_chk_cb: release ssl_load_pkcs12 memory.
     - ssl_load_key: avoid leaking gnutls_x509_privkey_t on error.
     - ssl_load_pkcs12: fix ssl_pkey leak on error path.
    
    Change-Id: I5db6fecb0d74e5c78796392aeb17e3eb7985a2ef
    Reviewed-on: https://code.wireshark.org/review/10764
    Reviewed-by: Peter Wu <peter@xxxxxxxxxxxxx>
    Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot <buildbot-no-reply@xxxxxxxxxxxxx>
    Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
    (cherry picked from commit 40ff4ffee88977b2981e29cb4ad8658394c8442e)
    Reviewed-on: https://code.wireshark.org/review/10851
    

Actions performed:

    from  ebad12f   Remove heur_dissector_set_enabled.
    adds  9d4080b   ssl-utils: simplify private key storage, fix resource leaks


Summary of changes:
 epan/dissectors/packet-dtls.c      |    4 +-
 epan/dissectors/packet-ssl-utils.c |  227 ++++++++++++------------------------
 epan/dissectors/packet-ssl-utils.h |   25 +---
 epan/dissectors/packet-ssl.c       |    4 +-
 4 files changed, 82 insertions(+), 178 deletions(-)