Backport of upstream commit f8fea38 (bsc#1261002)
"RAR5 reader: fix potential memory leak"
Free the filter if pushing it onto the deque fails. Adapted to libarchive 3.6.2.

diff -ru a/libarchive/archive_read_support_format_rar5.c b/libarchive/archive_read_support_format_rar5.c
--- a/libarchive/archive_read_support_format_rar5.c
+++ b/libarchive/archive_read_support_format_rar5.c
@@ -415,8 +415,7 @@
 		return CDE_OUT_OF_BOUNDS;
 }
 
-/* Pushes a new element into the end of this circular deque object. If current
- * size will exceed capacity, the oldest element will be overwritten. */
+/* Pushes a new element into the end of this circular deque object. */
 static int cdeque_push_back(struct cdeque* d, void* item) {
 	if(d == NULL)
 		return CDE_PARAM;
@@ -536,7 +535,11 @@
 		return NULL;
 	}
 
-	cdeque_push_back(&rar->cstate.filters, cdeque_filter(f));
+	if (CDE_OK != cdeque_push_back(&rar->cstate.filters, cdeque_filter(f))) {
+		free(f);
+		return NULL;
+	}
+
 	return f;
 }
 
