aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wmem/wmem_miscutl.h
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-03-16 12:41:41 +0100
committerEvan Huus <eapache@gmail.com>2018-03-19 16:15:35 +0000
commitacba1785460149b65a890a2b060ed87cf4e41102 (patch)
treee950601813720048dac5c390950d80b8cbfd03d4 /epan/wmem/wmem_miscutl.h
parent859c5bf836f31a4d60ea161acc8a52a7571477ba (diff)
wmem: ensure wmem_memdup(..., NULL, 0) returns NULL
Rather than requiring all callers to pass a non-null source argument, explicitly allow a NULL source when the size is zero. This is consistent with g_memdup behavior. While at it, fix a memleak and avoid memset(0,0,0) in tests. Change-Id: I86a092625a508544d180da959e4afdd0366539f4 Reviewed-on: https://code.wireshark.org/review/26496 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Mališa Vučinić <malishav@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/wmem/wmem_miscutl.h')
-rw-r--r--epan/wmem/wmem_miscutl.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/wmem/wmem_miscutl.h b/epan/wmem/wmem_miscutl.h
index c77e569d4d..012d60a7bb 100644
--- a/epan/wmem/wmem_miscutl.h
+++ b/epan/wmem/wmem_miscutl.h
@@ -33,7 +33,7 @@ extern "C" {
* @param allocator The allocator object to use to allocate memory to copy into.
* @param source The pointer to the memory block to copy.
* @param size The amount of memory to copy.
- * @return The location of the memory copy.
+ * @return The location of the memory copy or NULL if size is 0.
*/
WS_DLL_PUBLIC
void *