diff --git a/src/libafscp/afscp_server.c b/src/libafscp/afscp_server.c index a5fb47d004..e67ee48a9d 100644 --- a/src/libafscp/afscp_server.c +++ b/src/libafscp/afscp_server.c @@ -121,9 +121,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; }