Commit 249adf2813e886b58f6846691f769634d1dfab4e
1 parent
5cfbfd8a
Exists in
master
and in
2 other branches
Fixing segfault on 'non-session' log write.
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
src/core/log.c
| ... | ... | @@ -109,7 +109,7 @@ LIB3270_EXPORT int lib3270_write_log(H3270 *session, const char *module, const c |
| 109 | 109 | va_list arg_ptr; |
| 110 | 110 | va_start(arg_ptr, fmt); |
| 111 | 111 | |
| 112 | - if(session->logfile) { | |
| 112 | + if(session && session->logfile) { | |
| 113 | 113 | logfile(session,module ? module : LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME),0,fmt,arg_ptr); |
| 114 | 114 | } else { |
| 115 | 115 | loghandler(session,module ? module : LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME),0,fmt,arg_ptr); |
| ... | ... | @@ -123,7 +123,7 @@ LIB3270_EXPORT int lib3270_write_rc(H3270 *session, const char *module, int rc, |
| 123 | 123 | va_list arg_ptr; |
| 124 | 124 | va_start(arg_ptr, fmt); |
| 125 | 125 | |
| 126 | - if(session->logfile) { | |
| 126 | + if(session && session->logfile) { | |
| 127 | 127 | logfile(session,module ? module : LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME),rc,fmt,arg_ptr); |
| 128 | 128 | } else { |
| 129 | 129 | loghandler(session,module ? module : LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME),rc,fmt,arg_ptr); |
| ... | ... | @@ -134,7 +134,7 @@ LIB3270_EXPORT int lib3270_write_rc(H3270 *session, const char *module, int rc, |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | LIB3270_EXPORT void lib3270_write_va_log(H3270 *session, const char *module, const char *fmt, va_list arg) { |
| 137 | - if(session->logfile) { | |
| 137 | + if(session && session->logfile) { | |
| 138 | 138 | logfile(session,module ? module : LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME),0,fmt,arg); |
| 139 | 139 | } else { |
| 140 | 140 | loghandler(session,module ? module : LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME),0,fmt,arg); | ... | ... |