Skip to content

Commit

Permalink
Avoid leaking map_itr_t in is_subscribed(). Updated map and stack doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeDP committed Aug 20, 2019
1 parent 3b70803 commit a7a0dd5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions Lib/pubsub.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static bool is_subscribed(mod_t *mod, const char *topic) {
/* Execute regular expression */
int ret = regexec(reg, topic, 0, NULL, 0);
if (!ret) {
memhook._free(itr);
return true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/src/map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Where not specified, these functions return a map_ret_code.

.. c:function:: map_itr_new(m)
Create a new map iterator object.
Create a new map iterator object. Note that it can be freed with free().

:param m: pointer to map_t
:type m: :c:type:`const map_t *`
Expand All @@ -62,7 +62,7 @@ Where not specified, these functions return a map_ret_code.

.. c:function:: map_itr_next(itr)
Get next iterator.
Get next iterator. If next iterator is past last element, iterator will be automatically freed for you.

:param itr: pointer to map_itr_t
:type itr: :c:type:`map_itr_t *`
Expand Down
4 changes: 2 additions & 2 deletions docs/src/stack.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Where not specified, these functions return a stack_ret_code.

.. c:function:: stack_itr_new(s)
Create a new stack_itr_t object.
Create a new stack_itr_t object. Note that it can be freed with free().

:param s: pointer to stack_t
:type s: :c:type:`const stack_t *`
Expand All @@ -58,7 +58,7 @@ Where not specified, these functions return a stack_ret_code.

.. c:function:: stack_itr_next(itr)
Get next iterator.
Get next iterator. If next iterator is past last element, iterator will be automatically freed for you.

:param itr: pointer to stack_itr_t
:type itr: :c:type:`stack_itr_t *`
Expand Down

0 comments on commit a7a0dd5

Please sign in to comment.