diff mbox

linux-generic: queue: avoid leakage on queue create

Message ID 1460829977-15362-1-git-send-email-bill.fischofer@linaro.org
State Superseded
Headers show

Commit Message

Bill Fischofer April 16, 2016, 6:06 p.m. UTC
If a scheduled queue is created via odp_queue_create() but is unable
to be added to the scheduler queues destroy it rather than leaking
resources.

This resolves Bug https://bugs.linaro.org/show_bug.cgi?id=2186

Reported-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/odp_queue.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c
index 5963057..8d29284 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -274,6 +274,7 @@  odp_queue_t odp_queue_create(const char *name, const odp_queue_param_t *param)
 
 	if (handle != ODP_QUEUE_INVALID && type == ODP_QUEUE_TYPE_SCHED) {
 		if (schedule_queue_init(queue)) {
+			odp_queue_destroy(handle);
 			ODP_ERR("schedule queue init failed\n");
 			return ODP_QUEUE_INVALID;
 		}