Skip to content

Commit 87aedf8

Browse files
committed
fixed a double invocation of Py_DECREF in igraphmodule_filehandle_destroy
1 parent 3fa4415 commit 87aedf8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/filehandle.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@ int igraphmodule_filehandle_init(igraphmodule_filehandle_t* handle,
109109
* \brief Destroys the file handle object.
110110
*/
111111
void igraphmodule_filehandle_destroy(igraphmodule_filehandle_t* handle) {
112-
if (handle->fp != 0) {
113-
fflush(handle->fp);
114-
}
112+
if (handle->fp != 0) {
113+
fflush(handle->fp);
114+
}
115+
115116
handle->fp = 0;
116117

117118
if (handle->object != 0) {
@@ -121,10 +122,9 @@ void igraphmodule_filehandle_destroy(igraphmodule_filehandle_t* handle) {
121122
}
122123
}
123124
Py_DECREF(handle->object);
125+
handle->object = 0;
124126
}
125127

126-
Py_XDECREF(handle->object);
127-
handle->object = 0;
128128
handle->need_close = 0;
129129
}
130130

0 commit comments

Comments
 (0)