summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-09-12 01:17:26 +0300
committerVadim Yanitskiy <axilirator@gmail.com>2017-12-31 12:20:59 +0100
commitfb2326fbcf12abc47e3f24f6c2051e71d013705e (patch)
tree3d4659f6656ba0e50703a8f7d658358af292de1b
parent7279d9f05777855a0dc2873038bdb13557d174a3 (diff)
procqueue: set talloc name and context for queue description
Previously a queue description string was allocated without setting proper parental talloc context and proper name.
-rw-r--r--src/procqueue.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/procqueue.c b/src/procqueue.c
index c6661b5..5a75296 100644
--- a/src/procqueue.c
+++ b/src/procqueue.c
@@ -219,6 +219,10 @@ osmo_gapk_pq_describe(struct osmo_gapk_pq *pq)
char *result = NULL;
int i = 0;
+ /* Nothing to describe */
+ if (!pq->n_items)
+ return NULL;
+
/* Iterate over all items in queue */
llist_for_each_entry(item, &pq->items, list) {
result = talloc_asprintf_append(result, "%s/%s%s",
@@ -226,5 +230,11 @@ osmo_gapk_pq_describe(struct osmo_gapk_pq *pq)
++i < pq->n_items ? " -> " : "");
}
+ /* Change talloc context name */
+ talloc_set_name_const(result, ".description");
+
+ /* Change parent talloc context to pq */
+ talloc_steal(pq, result);
+
return result;
}