瀏覽代碼

timers_exit may be called without timers_init

bel 11 年之前
父節點
當前提交
d08f534309
共有 1 個文件被更改,包括 4 次插入2 次删除
  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);
+    }
 }