mirror of https://github.com/schoebel/mars
infra: safeguard free_mars_global
This commit is contained in:
parent
efbb44cf4b
commit
adaecce4c8
|
@ -165,8 +165,13 @@ do { \
|
|||
|
||||
#define free_mars_global(_global_) \
|
||||
({ \
|
||||
exit_mars_global(_global_); \
|
||||
brick_mem_free(_global_); \
|
||||
struct mars_global *__global = (_global_); \
|
||||
\
|
||||
if (__global) { \
|
||||
(_global_) = NULL; \
|
||||
exit_mars_global(__global); \
|
||||
brick_mem_free(__global); \
|
||||
} \
|
||||
})
|
||||
|
||||
extern void bind_to_dent(struct mars_dent *dent, struct say_channel **ch);
|
||||
|
|
|
@ -1189,10 +1189,12 @@ void exit_mars_global(struct mars_global *global)
|
|||
|
||||
void __mars_trigger(int mode)
|
||||
{
|
||||
if (mars_global) {
|
||||
mars_global->trigger_mode |= mode;
|
||||
mars_global->main_trigger = true;
|
||||
wake_up_interruptible_all(&mars_global->main_event);
|
||||
struct mars_global *global = mars_global;
|
||||
|
||||
if (global) {
|
||||
global->trigger_mode |= mode;
|
||||
global->main_trigger = true;
|
||||
wake_up_interruptible_all(&global->main_event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue