Skip to content

Commit 72520fe

Browse files
committed
Add comment and Coverity annotation
1 parent 220ad4e commit 72520fe

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

maxminddb/extension/maxminddb.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ static PyObject *from_map(MMDB_entry_data_list_s **entry_data_list)
354354
const uint32_t map_size = (*entry_data_list)->entry_data.data_size;
355355

356356
uint i;
357+
// entry_data_list cannot start out NULL (see from_entry_data_list). We
358+
// check it in the loop because it may become NULL.
359+
// coverity[check_after_deref]
357360
for (i = 0; i < map_size && entry_data_list; i++) {
358361
*entry_data_list = (*entry_data_list)->next;
359362

@@ -389,6 +392,9 @@ static PyObject *from_array(MMDB_entry_data_list_s **entry_data_list)
389392
}
390393

391394
uint i;
395+
// entry_data_list cannot start out NULL (see from_entry_data_list). We
396+
// check it in the loop because it may become NULL.
397+
// coverity[check_after_deref]
392398
for (i = 0; i < size && entry_data_list; i++) {
393399
*entry_data_list = (*entry_data_list)->next;
394400
PyObject *value = from_entry_data_list(entry_data_list);

0 commit comments

Comments
 (0)