mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
tools: fix allocation check and missing memory freeing
Fixed allocation checking and freeing buffer memory inside mt76_eeprom_changes() function. Signed-off-by: Mieczyslaw Nalewaj <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
3e85822b9c
commit
a22d59e4ad
+5
-1
@@ -220,10 +220,14 @@ mt76_eeprom_changes(void)
|
||||
}
|
||||
|
||||
buf = malloc(EEPROM_PART_SIZE);
|
||||
if (!buf)
|
||||
return EXIT_FAILURE;
|
||||
fseek(f, mtd_offset, SEEK_SET);
|
||||
ret = fread(buf, 1, EEPROM_PART_SIZE, f);
|
||||
if (ret != EEPROM_PART_SIZE)
|
||||
if (ret != EEPROM_PART_SIZE) {
|
||||
free(buf);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
for (i = 0; i < EEPROM_PART_SIZE; i++) {
|
||||
if (buf[i] == eeprom_data[i])
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user