This commit is contained in:
2021-09-08 21:07:25 +02:00
parent 03823cf903
commit 8647717fec

View File

@ -230,7 +230,7 @@ int writeToFlash(FILE *flashfd, FILE *srcfd, char *mess) {
if (buffer == NULL) { if (buffer == NULL) {
fclose(flashfd); fclose(flashfd);
fclose(srcfd); fclose(srcfd);
strcpy(mess, "Could not program foga. Memory allocation to write to " strcpy(mess, "Could not program fpga. Memory allocation to write to "
"flash failed.\n"); "flash failed.\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
return FAIL; return FAIL;
@ -243,6 +243,7 @@ int writeToFlash(FILE *flashfd, FILE *srcfd, char *mess) {
fwrite((void *)buffer, sizeof(char), bytes, flashfd); fwrite((void *)buffer, sizeof(char), bytes, flashfd);
totalBytes += bytesWritten; totalBytes += bytesWritten;
if (bytesWritten != bytes) { if (bytesWritten != bytes) {
free(buffer);
fclose(flashfd); fclose(flashfd);
fclose(srcfd); fclose(srcfd);
sprintf(mess, sprintf(mess,
@ -257,6 +258,7 @@ int writeToFlash(FILE *flashfd, FILE *srcfd, char *mess) {
printf("."); printf(".");
} }
printf("\n"); printf("\n");
free(buffer);
fclose(flashfd); fclose(flashfd);
fclose(srcfd); fclose(srcfd);
LOG(logINFO, ("\tWrote %ld bytes to flash\n", totalBytes)); LOG(logINFO, ("\tWrote %ld bytes to flash\n", totalBytes));