libafscp: Use strdup, rather than rolling our own
[openafs.git] / src / libafscp / afscp_server.c
index 92d29b0..abb82e8 100644 (file)
@@ -122,9 +122,7 @@ afscp_CellByName(const char *cellname, const char *realmname)
     memset(thecell, 0, sizeof(struct afscp_cell));
     strlcpy(thecell->name, cellname, sizeof(thecell->name));
     if (realmname != NULL) {
-       thecell->realm = malloc(strlen(realmname) + 1);
-       memset(thecell->realm, 0, strlen(realmname) + 1);
-       strlcpy(thecell->realm, realmname, strlen(realmname) + 1);
+       thecell->realm = strdup(realmname);
     } else {
        thecell->realm = NULL;
     }