diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2013-08-19 11:11:11 +0000 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2013-08-19 11:11:11 +0000 |
commit | 02cae558f997dba1fd17011cc84e317f17d17a4d (patch) | |
tree | 04df50265c151c9e45e6f75d59a7b5dd00e8c2df /asn1/snmp | |
parent | 81b6d6aab35eabd3c9687f3f2eb37466855fc137 (diff) |
Do not use ephemeral memory when adding a new data source
svn path=/trunk/; revision=51424
Diffstat (limited to 'asn1/snmp')
-rw-r--r-- | asn1/snmp/packet-snmp-template.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c index db18fb28b6..ba96d57c6a 100644 --- a/asn1/snmp/packet-snmp-template.c +++ b/asn1/snmp/packet-snmp-template.c @@ -1594,7 +1594,7 @@ snmp_usm_priv_des(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData _U_, gchar c cryptgrm = (guint8*)ep_tvb_memdup(encryptedData,0,-1); - cleartext = (guint8*)ep_alloc(cryptgrm_len); + cleartext = (guint8*)g_malloc(cryptgrm_len); err = gcry_cipher_open(&hd, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_CBC, 0); if (err != GPG_ERR_NO_ERROR) goto on_gcry_error; @@ -1611,10 +1611,12 @@ snmp_usm_priv_des(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData _U_, gchar c gcry_cipher_close(hd); clear_tvb = tvb_new_child_real_data(encryptedData, cleartext, cryptgrm_len, cryptgrm_len); + tvb_set_free_cb(clear_tvb, g_free); return clear_tvb; on_gcry_error: + g_free(cleartext); *error = (const gchar *)gpg_strerror(err); if (hd) gcry_cipher_close(hd); return NULL; @@ -1664,7 +1666,7 @@ snmp_usm_priv_aes_common(snmp_usm_params_t* p, tvbuff_t* encryptedData, gchar co } cryptgrm = (guint8*)ep_tvb_memdup(encryptedData,0,-1); - cleartext = (guint8*)ep_alloc(cryptgrm_len); + cleartext = (guint8*)g_malloc(cryptgrm_len); err = gcry_cipher_open(&hd, algo, GCRY_CIPHER_MODE_CFB, 0); if (err != GPG_ERR_NO_ERROR) goto on_gcry_error; @@ -1681,10 +1683,12 @@ snmp_usm_priv_aes_common(snmp_usm_params_t* p, tvbuff_t* encryptedData, gchar co gcry_cipher_close(hd); clear_tvb = tvb_new_child_real_data(encryptedData, cleartext, cryptgrm_len, cryptgrm_len); + tvb_set_free_cb(clear_tvb, g_free); return clear_tvb; on_gcry_error: + g_free(cleartext); *error = (const gchar *)gpg_strerror(err); if (hd) gcry_cipher_close(hd); return NULL; |