mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-05 10:39:27 +02:00
Initialize f to NULL to make sure it is initialized before cleanup
This commit is contained in:
parent
f2bdc2669b
commit
e35cb3e720
1 changed files with 3 additions and 2 deletions
|
@ -1381,6 +1381,7 @@ int dc_read_file(dc_context_t* context, const char* pathNfilename, void** buf, s
|
||||||
{
|
{
|
||||||
int success = 0;
|
int success = 0;
|
||||||
char* pathNfilename_abs = NULL;
|
char* pathNfilename_abs = NULL;
|
||||||
|
FILE* f = NULL;
|
||||||
|
|
||||||
if (pathNfilename==NULL || buf==NULL || buf_bytes==NULL) {
|
if (pathNfilename==NULL || buf==NULL || buf_bytes==NULL) {
|
||||||
return 0; /* do not go to cleanup as this would dereference "buf" and "buf_bytes" */
|
return 0; /* do not go to cleanup as this would dereference "buf" and "buf_bytes" */
|
||||||
|
@ -1393,7 +1394,7 @@ int dc_read_file(dc_context_t* context, const char* pathNfilename, void** buf, s
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* f = fopen(pathNfilename_abs, "rb");
|
f = fopen(pathNfilename_abs, "rb");
|
||||||
if (f==NULL) { goto cleanup; }
|
if (f==NULL) { goto cleanup; }
|
||||||
|
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
|
@ -1533,4 +1534,4 @@ cleanup:
|
||||||
free(blobdir_path);
|
free(blobdir_path);
|
||||||
free(filename);
|
free(filename);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue