Null Test After Dereference at mail-transaction-log.c:442 |
No properties have been set. edit properties |
Jump to warning location ↓ | warning details... |
| |
mail_transaction_log_lock_head (/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-index/mail-transaction-log.c)![]() | ||||||
![]() | ||||||
412 | int mail_transaction_log_lock_head(struct mail_transaction_log *log) | |||||
413 | { | |||||
414 | struct mail_transaction_log_file *file; | |||||
415 | int ret = 0; | |||||
416 | ||||||
417 | /* we want to get the head file locked. this is a bit racy, | |||||
418 | since by the time we have it locked a new log file may have been | |||||
419 | created. | |||||
420 | ||||||
421 | creating new log file requires locking the head file, so if we | |||||
422 | can lock it and don't see another file, we can be sure no-one is | |||||
423 | creating a new log at the moment */ | |||||
424 | ||||||
425 | for (;;) { | |||||
426 | file = log->head; | |||||
427 | if (mail_transaction_log_file_lock(file) < 0) | |||||
428 | return -1; | |||||
429 | ||||||
430 | file->refcount++; | |||||
431 | ret = mail_transaction_log_refresh(log, TRUE); | |||||
432 | if (--file->refcount == 0) { | |||||
433 | mail_transaction_logs_clean(log); | |||||
434 | file = NULL; | |||||
435 | } | |||||
436 | ||||||
437 | if (ret == 0 && log->head == file) { | |||||
438 | /* success */ | |||||
439 | break; | |||||
440 | } | |||||
441 | ||||||
442 | if (file != NULL)
| |||||
443 | mail_transaction_log_file_unlock(file); | |||||
444 | ||||||
445 | if (ret < 0) | |||||
446 | break; | |||||
447 | ||||||
448 | /* try again */ | |||||
449 | } | |||||
450 | ||||||
451 | return ret; | |||||
452 | } | |||||
![]() |