summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Greenan <kmg@box.com>2014-06-03 09:51:25 -0700
committerKevin Greenan <kmg@box.com>2014-06-03 09:51:25 -0700
commit50f6b5769bc11b8016538f2cde94abde4e9e4150 (patch)
tree9b18875516531c70d115d209f6d60b9e26635e03
parent0c144dd580d5ce430639caddbe830ce9ef3498e3 (diff)
downloadpyeclib-50f6b5769bc11b8016538f2cde94abde4e9e4150.tar.gz
Fix a memory leak found by Eric Lambert
-rw-r--r--c_eclib-0.9/xor_codes/xor_hd_code.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/c_eclib-0.9/xor_codes/xor_hd_code.c b/c_eclib-0.9/xor_codes/xor_hd_code.c
index 3f9aaae..879fee3 100644
--- a/c_eclib-0.9/xor_codes/xor_hd_code.c
+++ b/c_eclib-0.9/xor_codes/xor_hd_code.c
@@ -452,10 +452,15 @@ static void decode_three_data(xor_code_t *code_desc, char **data, char **parity,
fprintf(stderr, "Shit is broken, cannot construct equations to repair 3 failures!!!\n");
exit(2);
}
+ // Copy the appropriate parity into the data buffer
+ fast_memcpy(data[data_index], parity_buffer, blocksize);
+ // Free up the buffer we allocated above
+ aligned_free(parity_buffer);
+ } else {
+ // Copy the appropriate parity into the data buffer
+ fast_memcpy(data[data_index], parity_buffer, blocksize);
}
- // Copy the appropriate parity into the data buffer
- fast_memcpy(data[data_index], parity_buffer, blocksize);
for (i=0; i < code_desc->k; i++) {
if (i != data_index && is_data_in_parity(i, parity_bm)) {