Skip to content

Commit

Permalink
Fixed memory scoping error for Mutex in AqvmBaseFile_File.
Browse files Browse the repository at this point in the history
  • Loading branch information
ax-6 committed Jul 31, 2024
1 parent b9ab0c5 commit 02548d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions aqvm/base/file/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int AqvmBaseFile_LockFile(struct AqvmBaseFile_File* file) {
return -1;
}

int result = AqvmBaseThreadingMutex_LockMutex(file->mutex);
int result = AqvmBaseThreadingMutex_LockMutex(&file->mutex);
if (result != 0) {
// TODO
return -2;
Expand All @@ -30,7 +30,7 @@ int AqvmBaseFile_UnlockFile(struct AqvmBaseFile_File* file) {
return -1;
}

int result = AqvmBaseThreadingMutex_UnlockMutex(file->mutex);
int result = AqvmBaseThreadingMutex_UnlockMutex(&file->mutex);
if (result != 0) {
// TODO
return -2;
Expand Down Expand Up @@ -59,7 +59,7 @@ int AqvmBaseFile_fclose(struct AqvmBaseFile_File* stream) {
return -2;
}

if (AqvmBaseThreadingMutex_CloseMutex(stream->mutex)) {
if (AqvmBaseThreadingMutex_CloseMutex(&stream->mutex)) {
// TODO
return -3;
}
Expand Down Expand Up @@ -160,7 +160,7 @@ struct AqvmBaseFile_File* AqvmBaseFile_fopen(const char* filename,
return NULL;
}

if (AqvmBaseThreadingMutex_InitializeMutex(stream->mutex) != 0) {
if (AqvmBaseThreadingMutex_InitializeMutex(&stream->mutex) != 0) {
fclose(stream->file);
free(stream);
return NULL;
Expand Down Expand Up @@ -427,7 +427,7 @@ struct AqvmBaseFile_File* AqvmBaseFile_tmpfile(void) {
return NULL;
}

AqvmBaseThreadingMutex_InitializeMutex(stream->mutex);
AqvmBaseThreadingMutex_InitializeMutex(&stream->mutex);

return stream;
}
Expand Down
2 changes: 1 addition & 1 deletion aqvm/base/file/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

struct AqvmBaseFile_File {
FILE* file;
AqvmBaseThreadingMutex_Mutex* mutex;
AqvmBaseThreadingMutex_Mutex mutex;
};

int AqvmBaseFile_LockFile(struct AqvmBaseFile_File* file);
Expand Down
2 changes: 1 addition & 1 deletion aqvm/base/logging/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ int AqvmBaseLogging_OutputLogToFile(const char* format, ...) {
}

va_end(args);
fclose(log_ptr);
AqvmBaseFile_fclose(log_ptr);
return result;
}

0 comments on commit 02548d6

Please sign in to comment.