aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-05-04 23:40:40 +0200
committerronnie sahlberg <ronniesahlberg@gmail.com>2018-05-09 03:05:20 +0000
commitc1deca140141a05d6d6a82b854eafa0f11c21e63 (patch)
tree556355f6da85b792ca9ec36b0544086d785f23e2 /epan
parente9c5d937b5e78b63b58116e300fa7553b83d1a3d (diff)
smb: fix memleak in export objects
"aux_smb_fid_type_string" is used as "%s" argument for g_strdup_printf, there is no need to clone it. I checked all calls and "fid_type" should always be valid, but in case of a bug, let's not return a NULL pointer but "?". Found by Clang Static Analyzer. Change-Id: I09896638eb5512f22b3d1a227462499e12cedcde Reviewed-on: https://code.wireshark.org/review/27349 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: ronnie sahlberg <ronniesahlberg@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-smb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c
index 53d77db222..2c509104c7 100644
--- a/epan/dissectors/packet-smb.c
+++ b/epan/dissectors/packet-smb.c
@@ -1231,12 +1231,12 @@ smb_eo_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const
gboolean is_supported_filetype;
gfloat percent;
- gchar *aux_smb_fid_type_string;
+ const gchar *aux_smb_fid_type_string;
if (eo_info->smbversion==1) {
/* Is this an eo_smb supported file_type? (right now we only support FILE) */
is_supported_filetype = (eo_info->fid_type == SMB_FID_TYPE_FILE);
- aux_smb_fid_type_string=g_strdup(try_val_to_str(eo_info->fid_type, smb_fid_types));
+ aux_smb_fid_type_string = val_to_str_const(eo_info->fid_type, smb_fid_types, "?");
/* What kind of data this packet contains? */
switch(eo_info->cmd) {
@@ -1255,7 +1255,7 @@ smb_eo_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const
} else {
/* Is this an eo_smb supported file_type? (right now we only support FILE) */
is_supported_filetype = (eo_info->fid_type == SMB2_FID_TYPE_FILE );
- aux_smb_fid_type_string=g_strdup(try_val_to_str(eo_info->fid_type, smb2_fid_types));
+ aux_smb_fid_type_string = val_to_str_const(eo_info->fid_type, smb2_fid_types, "?");
/* What kind of data this packet contains? */
switch(eo_info->cmd) {