diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2002-06-09 06:00:30 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2002-06-09 06:00:30 +0000 |
commit | 1a3711cb70edc22417d6017b8d48d5c24f431c73 (patch) | |
tree | 5ba91f5f5ac7dbd8cf02b13cbd6e515b29d93bec /lib/gnutls_mem.c | |
parent | ba634e9658ba041db078839fb313a2579bbbdfc9 (diff) | |
download | gnutls-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.c | 13 |
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; +} |