Skip to content

Commit 5e00fc9

Browse files
committed
NULL pointer deref fix
1 parent 14f0451 commit 5e00fc9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/serve_state.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ serve_state_init(int contest_id)
6565
state->teamdb_state = teamdb_init(contest_id);
6666
state->runlog_state = run_init(state->teamdb_state);
6767

68-
++metrics.data->loaded_contests;
68+
if (metrics.data) {
69+
++metrics.data->loaded_contests;
70+
}
6971

7072
return state;
7173
}
@@ -253,7 +255,9 @@ serve_state_destroy(
253255
xfree(state->compiler_options);
254256
}
255257

256-
--metrics.data->loaded_contests;
258+
if (members.data) {
259+
--metrics.data->loaded_contests;
260+
}
257261

258262
memset(state, 0, sizeof(*state));
259263
xfree(state);

0 commit comments

Comments
 (0)