Explorar el Código

timers_exit may be called without timers_init

bel hace 11 años
padre
commit
d08f534309
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      src/timer.inl

+ 4 - 2
src/timer.inl

@@ -124,6 +124,8 @@ static int timers_init(struct mg_context * ctx)
 
 static void timers_exit(struct mg_context * ctx)
 {
-    (void) pthread_mutex_destroy(&ctx->timers->mutex);
-    mg_free(ctx->timers);
+    if (ctx->timers) {
+        (void) pthread_mutex_destroy(&ctx->timers->mutex);
+        mg_free(ctx->timers);
+    }
 }