aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
Diffstat (limited to 'epan')
-rw-r--r--epan/emem.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/epan/emem.c b/epan/emem.c
index 31fb671d97..4b0190c66b 100644
--- a/epan/emem.c
+++ b/epan/emem.c
@@ -361,10 +361,18 @@ void* se_alloc0(size_t size) {
return memset(se_alloc(size),'\0',size);
}
+/* If str is NULL, just return the string "<NULL>" so that the callers dont
+ * have to bother checking it.
+ */
gchar* se_strdup(const gchar* src) {
- guint len = strlen(src);
+ guint len;
gchar* dst;
+ if(!src){
+ return "<NULL>";
+ }
+
+ len = strlen(src);
dst = strncpy(se_alloc(len+1), src, len);
dst[len] = '\0';