diff --git a/apps/app_queue.c b/apps/app_queue.c
index 61630d14d891c69a3329586d9e081cee8eafe365..fef9685bd822b01c8c9e3eea6b6c7ffe51873550 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -782,6 +782,7 @@ static int handle_statechange(void *datap)
 	if (!curint) {
 		if (option_debug > 2)
 			ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s) but we don't care because they're not a member of any queue.\n", technology, loc, sc->state, devstate2str(sc->state));
+		ast_free(sc);
 		return 0;
 	}