about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2018-03-30 00:56:26 +0000
committerThomas E. Dickey <dickey@invisible-island.net>2018-03-30 00:56:26 +0000
commitdb24197ddd55e9578c129ec5b4e30cb2cc2a580b (patch)
treea209005b45cf95bcb5dc3ec61060238229dd9540 /src
parentac9f8d52a8715476153ade910dd81436bfdea2a7 (diff)
downloadlynx-snapshots-db24197ddd55e9578c129ec5b4e30cb2cc2a580b.tar.gz
snapshot of project "lynx", label v2-8-9dev_17e
Diffstat (limited to 'src')
-rw-r--r--src/LYLeaks.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/LYLeaks.c b/src/LYLeaks.c
index 52b86b91..2f2de289 100644
--- a/src/LYLeaks.c
+++ b/src/LYLeaks.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYLeaks.c,v 1.39 2018/03/28 09:28:32 tom Exp $
+ * $LynxId: LYLeaks.c,v 1.41 2018/03/30 00:27:58 tom Exp $
  *
  *	Copyright (c) 1994, University of Kansas, All Rights Reserved
  *	(this file was rewritten twice - 1998/1999 and 2003/2004)
@@ -742,6 +742,22 @@ void LYLeakFree(void *vp_Alloced,
 }
 
 /*
+ * Check for leaked strdup() results -TD
+ */
+char *LYLeakStrdup(const char *source,
+		   const char *cp_File,
+		   const short ssi_Line)
+{
+    size_t length = strlen(source) + 1;
+    char *target = (char *) LYLeakMalloc(length, cp_File, ssi_Line);
+
+    if (target != 0) {
+	memcpy(target, source, length);
+    }
+    return target;
+}
+
+/*
  *  Allocates a new copy of a string, and returns it.
  *  Tracks allocations by using other LYLeakFoo functions.
  *  Equivalent to HTSACopy in HTString.c - KW