소스 검색

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)
 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);
+    }
 }
 }