Commit Diff


commit - 69be7a85a2117f0526ca4e113a806be989dc2f53
commit + d67d077a711f21e722d969dc1bf7ab787042d70b
blob - 45a4874b6e94f268aa2a0942cdf249c4aec12a24
blob + 5c6c52c4c9b2c9f15a4bdddcd05bef422125b929
--- src/ngircd/lists.c
+++ src/ngircd/lists.c
@@ -147,11 +147,8 @@ Lists_Add(struct list_head *h, const char *Mask, time_
 
 	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!");
 	}