summaryrefslogtreecommitdiff
path: root/lib/vector.h
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-10-06 17:35:07 +0300
committerIgor Ryzhov <iryzhov@nfware.com>2021-10-06 19:13:12 +0300
commit72618ba82af966bbde6fda49905f6b2b6fa25fd0 (patch)
treeed7d02431871bec8d4b56342e9220350b108ee0c /lib/vector.h
parent3f220bc814abeb11a17fad80f14c7ba79af67429 (diff)
lib: fix incorrect thread management
The current code passes an address of a local variable to `thread_add_read` which stores it into `thread->ref` by the lib. The next time the thread callback is executed, the lib stores NULL into the `thread->ref` which means it writes into some random memory on the stack. To fix this, we should pass a pointer to the vector entry to the lib. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib/vector.h')
-rw-r--r--lib/vector.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/vector.h b/lib/vector.h
index d5857eb599..845c8d8b04 100644
--- a/lib/vector.h
+++ b/lib/vector.h
@@ -54,6 +54,7 @@ extern void vector_ensure(vector v, unsigned int num);
extern int vector_empty_slot(vector v);
extern int vector_set(vector v, void *val);
extern int vector_set_index(vector v, unsigned int i, void *val);
+extern void **vector_get_index(vector v, unsigned int i);
extern void vector_unset(vector v, unsigned int i);
extern void vector_unset_value(vector v, void *val);
extern void vector_remove(vector v, unsigned int ix);