Skip to content

Commit 952ff46

Browse files
committed
nit
1 parent 29e1076 commit 952ff46

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Modules/syslogmodule.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,12 @@ syslog_closelog_impl(PyObject *module)
233233
_syslog_state *state = get_syslog_state(module);
234234
if (state->S_log_open) {
235235
closelog();
236-
Py_CLEAR(state->S_ident_o);
237236
state->S_log_open = 0;
238237
}
238+
239+
if (state->S_ident_o != NULL) {
240+
Py_CLEAR(state->S_ident_o);
241+
}
239242
Py_RETURN_NONE;
240243
}
241244

@@ -397,9 +400,12 @@ _syslog_clear(PyObject *module)
397400
_syslog_state *state = get_syslog_state(module);
398401
if (state->S_log_open) {
399402
closelog();
400-
Py_CLEAR(state->S_ident_o);
401403
state->S_log_open = 0;
402404
}
405+
406+
if (state->S_ident_o != NULL) {
407+
Py_CLEAR(state->S_ident_o);
408+
}
403409
return 0;
404410
}
405411

0 commit comments

Comments
 (0)