Skip to content

Commit

Permalink
Fix the size of cap_list and res list in 6:1:4
Browse files Browse the repository at this point in the history
Spotted by @jamtho via schwehr#164
  • Loading branch information
schwehr authored and enriquetuya committed Nov 20, 2017
1 parent 472c410 commit 3173a4f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/libais/ais_py.cpp
Expand Up @@ -418,9 +418,10 @@ ais6_1_4_append_pydict(const char *nmea_payload, PyObject *dict,
}

DictSafeSetItem(dict, "ack_dac", msg.ack_dac);
PyObject *cap_list = PyList_New(26);
PyObject *res_list = PyList_New(26);
for (size_t cap_num = 0; cap_num < 128/2; cap_num++) {
constexpr int kNumFI = 64;
PyObject *cap_list = PyList_New(kNumFI);
PyObject *res_list = PyList_New(kNumFI);
for (size_t cap_num = 0; cap_num < kNumFI; cap_num++) {
// TODO(schwehr): memory leak?
PyObject *cap = PyLong_FromLong(long(msg.capabilities[cap_num])); // NOLINT
PyList_SetItem(cap_list, cap_num, cap);
Expand Down

0 comments on commit 3173a4f

Please sign in to comment.