From: Marcio Barbosa Date: Tue, 28 Jun 2016 15:48:06 +0000 (-0300) Subject: venus: fix memory leak X-Git-Tag: upstream/1.6.20^2~22 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ec8ef18fad54a4de562969a6d7f9ad98abee251f;p=packages%2Fo%2Fopenafs.git venus: fix memory leak The fs getserverprefs command displays preference ranks for file / volume location server machine interfaces. In order to get the complete set of preference ranks, the VIOC_GETSPREFS system call might have to be called several times. If so, the memory previously allocated should be released. Reviewed-on: https://gerrit.openafs.org/12315 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit d3b8a05d229a80100f40fca4dfdcd820313fcea8) Change-Id: Iccd9b98aea1c7cf1d63ad20c470baabe09f7a0d7 Reviewed-on: https://gerrit.openafs.org/12340 Tested-by: BuildBot Reviewed-by: Marcio Brito Barbosa Reviewed-by: Jeffrey Altman Reviewed-by: Mark Vitale Reviewed-by: Stephan Wiesand --- diff --git a/src/venus/fs.c b/src/venus/fs.c index 37b178876..9bdd1fba1 100644 --- a/src/venus/fs.c +++ b/src/venus/fs.c @@ -3305,10 +3305,10 @@ GetPrefCmd(struct cmd_syndesc *as, void *arock) } in->offset = out->next_offset; - } while (out->next_offset > 0); - - if (blob.out != space) - free(blob.out); + if (blob.out != space) { + free(blob.out); + } + } while (in->offset > 0); return 0; }