43768781c821683f4824f5b5a198774abfef5127
Fixed multiple uninitialized memory issues detected by valgrind: 1. SHA256 struct size mismatch: Changed from 64 bytes to 32 bytes to match the actual output of sha256() function (which produces 256 bits = 32 bytes). 2. File tree chunk allocation: Fixed loop that wasn't initializing newly allocated chunks because num_chunks was updated before the initialization loop. Now saves old_num_chunks first. 3. Metadata server process_client_write: Initialized results[i].num_addrs to 0 before use to prevent reading uninitialized value. 4. Address struct initialization: Zero-initialize Address structs before setting fields to ensure the entire union is initialized (union contains either IPv4 or IPv6, leaving unused bytes uninitialized). 5. Fixed bug in IPv6 address creation: Changed incorrect is_ipv4=true to is_ipv4=false for IPv6 addresses. 6. Fixed all_chunk_servers_holding_chunk: Function was incrementing counter for all chunk servers instead of only those containing the hash, causing access to uninitialized array elements. All valgrind errors resolved: ERROR SUMMARY: 0 errors from 0 contexts
Languages
C
98.4%
Shell
1%
Zig
0.4%
Batchfile
0.2%