dont leak
diff --git a/libtelnet.c b/libtelnet.c
index 6c5026e..92f8cfd 100644
--- a/libtelnet.c
+++ b/libtelnet.c
@@ -198,7 +198,7 @@
 	/* we're going to need to track state for it, so grow the queue
 	 * and put the telopt into it; bail on allocation error
 	 */
-	if ((qtmp = (telnet_rfc1143_t *)malloc(sizeof(
+	if ((qtmp = (telnet_rfc1143_t *)realloc(telnet->q, sizeof(
 			telnet_rfc1143_t) * (telnet->q_size + 1))) == 0) {
 		_error(telnet, __LINE__, __func__, TELNET_ENOMEM, 0,
 				"malloc() failed: %s", strerror(errno));