summaryrefslogtreecommitdiff
path: root/lib/gnutls_mem.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2002-06-09 06:00:30 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2002-06-09 06:00:30 +0000
commit1a3711cb70edc22417d6017b8d48d5c24f431c73 (patch)
tree5ba91f5f5ac7dbd8cf02b13cbd6e515b29d93bec /lib/gnutls_mem.c
parentba634e9658ba041db078839fb313a2579bbbdfc9 (diff)
downloadgnutls-1a3711cb70edc22417d6017b8d48d5c24f431c73.tar.gz
only use the libc's strdup, if using the libc's malloc function.
Diffstat (limited to 'lib/gnutls_mem.c')
-rw-r--r--lib/gnutls_mem.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/gnutls_mem.c b/lib/gnutls_mem.c
index c7ec4e0886..a953d1d6b0 100644
--- a/lib/gnutls_mem.c
+++ b/lib/gnutls_mem.c
@@ -58,3 +58,16 @@ svoid *gnutls_secure_calloc(size_t nmemb, size_t size)
return ret;
}
+char* _gnutls_strdup( const char* str) {
+int siz = strlen( str);
+char * ret;
+
+ ret = gnutls_malloc( siz + 1);
+ if (ret == NULL)
+ return ret;
+
+ memcpy( ret, str, siz);
+ ret[ siz] = 0;
+
+ return ret;
+}