Skip to content

Commit 309c995

Browse files
committed
Merge branch 'jt/object-file-use-container-of' into next
Code clean-up. * jt/object-file-use-container-of: object-file.c: avoid container_of() of a NULL container
2 parents ad6abc1 + 8e06f96 commit 309c995

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

object-file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ struct odb_transaction_files {
735735
static void prepare_loose_object_transaction(struct odb_transaction *base)
736736
{
737737
struct odb_transaction_files *transaction =
738-
container_of(base, struct odb_transaction_files, base);
738+
container_of_or_null(base, struct odb_transaction_files, base);
739739

740740
/*
741741
* We lazily create the temporary object directory
@@ -755,7 +755,7 @@ static void fsync_loose_object_transaction(struct odb_transaction *base,
755755
int fd, const char *filename)
756756
{
757757
struct odb_transaction_files *transaction =
758-
container_of(base, struct odb_transaction_files, base);
758+
container_of_or_null(base, struct odb_transaction_files, base);
759759

760760
/*
761761
* If we have an active ODB transaction, we issue a call that

0 commit comments

Comments
 (0)