Skip to content

Commit

Permalink
Merge pull request #20 from CAIDA/fix-pybgpstream-segfault
Browse files Browse the repository at this point in the history
Fix segfault in `BGPStream.get_data_interfaces`
  • Loading branch information
chiaraorsini committed Apr 26, 2016
2 parents 4a35f92 + b835c72 commit 07dcf71
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pybgpstream/src/_pybgpstream_bgpstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,20 @@ BGPStream_get_data_interfaces(BGPStreamObject *self)
return NULL;

info = bgpstream_get_data_interface_info(self->bs, ids[i]);
if(info == NULL) {
/* this data interface is not available */
continue;
}

/* add info to dict */

/* id */
#if PY_MAJOR_VERSION > 2
ADD_TO_DICT("id", PyLong_FromLong(ids[i]));
#else
ADD_TO_DICT("id", PyInt_FromLong(ids[i]));
ADD_TO_DICT("id", PyInt_FromLong(ids[i]));
#endif

/* name */
ADD_TO_DICT("name", PYSTR_FROMSTR(info->name));

Expand Down

0 comments on commit 07dcf71

Please sign in to comment.