Merge pull request #310 from jstafford/reference-count-bugfix

add missing hiwire_decref, fixes issue #301
This commit is contained in:
Michael Droettboom 2019-01-28 19:07:35 -05:00 committed by GitHub
commit 22be7eec9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -200,13 +200,15 @@ JsProxy_IterNext(PyObject* o)
int iddone = hiwire_get_member_string(idresult, (int)"done");
int done = hiwire_nonzero(iddone);
hiwire_decref(iddone);
if (done) {
return NULL;
PyObject* pyvalue = NULL;
if (!done) {
int idvalue = hiwire_get_member_string(idresult, (int)"value");
pyvalue = js2python(idvalue);
hiwire_decref(idvalue);
}
int idvalue = hiwire_get_member_string(idresult, (int)"value");
PyObject* pyvalue = js2python(idvalue);
hiwire_decref(idvalue);
hiwire_decref(idresult);
return pyvalue;
}