1
0
Fork 0
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:
Lars-Magnus Skog 2019-01-08 16:12:37 +01:00
parent f2bdc2669b
commit e35cb3e720

View file

@ -1381,6 +1381,7 @@ int dc_read_file(dc_context_t* context, const char* pathNfilename, void** buf, s
{
int success = 0;
char* pathNfilename_abs = NULL;
FILE* f = NULL;
if (pathNfilename==NULL || buf==NULL || buf_bytes==NULL) {
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;
}
FILE* f = fopen(pathNfilename_abs, "rb");
f = fopen(pathNfilename_abs, "rb");
if (f==NULL) { goto cleanup; }
fseek(f, 0, SEEK_END);
@ -1533,4 +1534,4 @@ cleanup:
free(blobdir_path);
free(filename);
return success;
}
}