From 5b0e0abca58e10397b0a21ee46b09bc9b5381703 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Wed, 6 Oct 1999 15:02:23 +0000 Subject: [PATCH] (krb5_copy_host_realm): copy all the strings git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7117 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/copy_host_realm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/krb5/copy_host_realm.c b/lib/krb5/copy_host_realm.c index 7fddcd907..6f1367853 100644 --- a/lib/krb5/copy_host_realm.c +++ b/lib/krb5/copy_host_realm.c @@ -60,7 +60,12 @@ krb5_copy_host_realm(krb5_context context, return ENOMEM; for (i = 0; i < n; ++i) (*to)[i] = NULL; - for (i = 0, p = from; *p != NULL; ++p, ++i) - (*to)[i] = *p; + for (i = 0, p = from; *p != NULL; ++p, ++i) { + (*to)[i] = strdup(*p); + if ((*to)[i] == NULL) { + krb5_free_host_realm (context, *to); + return ENOMEM; + } + } return 0; }