aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mswsp.c
diff options
context:
space:
mode:
authorMoshe Kaplan <me@moshekaplan.com>2020-12-20 21:30:28 -0500
committerAndersBroman <a.broman58@gmail.com>2020-12-22 14:56:38 +0000
commite16166a74cca1d66e2c302e257cf94aebb380599 (patch)
tree8834b4b8390fca83dd7bc1b4b9e6a7bb276e1d7e /epan/dissectors/packet-mswsp.c
parent7b27b444cbd94853b399da770e0dad4b91ef23ac (diff)
Detect and replace bad allocation patterns
Adds a pre-commit hook for detecting and replacing occurrences of `g_malloc()` and `wmem_alloc()` with `g_new()` and `wmem_new()`, to improve the readability of Wireshark's code, and occurrences of `g_malloc(sizeof(struct myobj) * foo)` with `g_new(struct myobj, foo)` to prevent integer overflows Also fixes all existing occurrences across the codebase.
Diffstat (limited to 'epan/dissectors/packet-mswsp.c')
-rw-r--r--epan/dissectors/packet-mswsp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/dissectors/packet-mswsp.c b/epan/dissectors/packet-mswsp.c
index 09d412bf06..37ad06c2b2 100644
--- a/epan/dissectors/packet-mswsp.c
+++ b/epan/dissectors/packet-mswsp.c
@@ -755,7 +755,7 @@ static struct message_data *find_or_create_message_data(struct mswsp_ct *conv_da
result = g_slist_find_custom(conv_data->GSL_message_data,
&to_find, (GCompareFunc)msg_data_find);
if (!result) {
- msg_data = (struct message_data *)wmem_alloc(wmem_file_scope(), sizeof(struct message_data));
+ msg_data = wmem_new(wmem_file_scope(), struct message_data);
*msg_data = to_find;
conv_data->GSL_message_data = g_slist_prepend(conv_data->GSL_message_data, msg_data);
} else {