about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/ngircd/lists.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/ngircd/lists.c b/src/ngircd/lists.c
index 45a4874b..5c6c52c4 100644
--- a/src/ngircd/lists.c
+++ b/src/ngircd/lists.c
@@ -147,11 +147,8 @@ Lists_Add(struct list_head *h, const char *Mask, time_t ValidUntil,
 
 	strlcpy(newelem->mask, Mask, sizeof(newelem->mask));
 	if (Reason) {
-		newelem->reason = malloc(strlen(Reason) + 1);
-		if (newelem->reason)
-			strlcpy(newelem->reason, Reason,
-				sizeof(newelem->reason));
-		else
+		newelem->reason = strdup(Reason);
+		if (!newelem->reason)
 			Log(LOG_EMERG,
 			    "Can't allocate memory for new list reason text!");
 	}