Commit 60d6193
committed
cli: fix memory leak in volume status detail
gf_cli_status_cbk() never freed the heap strings status.free and
status.total returned by gf_uint64_2human_readable() via gf_asprintf().
Each invocation of `gluster volume status all detail` leaked two
strings per brick reported.
Also fix a pre-existing leak of status.pid_str on error paths — freed
inside the loop but missing from the out: cleanup label.
Since GF_FREE() does not NULL the freed pointer, explicitly NULL all
per-iteration pointers after freeing to prevent double-free when the
normal path falls through to out:.
Fixes: #4292
Signed-off-by: Thales Antunes de Oliveira Barretto <thales.barretto.git@gmail.com>1 parent ae1d696 commit 60d6193
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7601 | 7601 | | |
7602 | 7602 | | |
7603 | 7603 | | |
7604 | | - | |
7605 | 7604 | | |
| 7605 | + | |
| 7606 | + | |
| 7607 | + | |
| 7608 | + | |
| 7609 | + | |
7606 | 7610 | | |
7607 | 7611 | | |
7608 | 7612 | | |
| |||
7615 | 7619 | | |
7616 | 7620 | | |
7617 | 7621 | | |
| 7622 | + | |
| 7623 | + | |
| 7624 | + | |
7618 | 7625 | | |
7619 | 7626 | | |
7620 | 7627 | | |
| |||
0 commit comments