Skip to content

Commit

Permalink
Fix memory leak in get_communities_pyset()
Browse files Browse the repository at this point in the history
affected all uses of the elem.fields dict
  • Loading branch information
kenkeys committed Apr 5, 2019
1 parent 394908e commit 8536202
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/_pybgpstream_bgpelem.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ static PyObject *get_communities_pyset(bgpstream_community_set_t *communities)
}

/* add community to set */
PySet_Add(set, PYSTR_FROMSTR(comm_buf));
PyObject *pystr = PYSTR_FROMSTR(comm_buf);
PySet_Add(set, pystr); // does NOT steal reference
Py_DECREF(pystr);
}
return set;
}
Expand Down

0 comments on commit 8536202

Please sign in to comment.