mirror of
https://github.com/sheumann/hush.git
synced 2024-12-21 23:29:34 +00:00
hush: plug a memory leak
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
65d722bb0d
commit
385cc59117
@ -4136,6 +4136,7 @@ static NOINLINE int run_pipe(struct pipe *pi)
|
||||
|
||||
/* if someone gives us an empty string: `cmd with empty output` */
|
||||
if (!argv_expanded[0]) {
|
||||
free(argv_expanded);
|
||||
debug_leave();
|
||||
return G.last_exitcode;
|
||||
}
|
||||
|
3
shell/hush_test/hush-z_slow/leak_empty_tick.right
Normal file
3
shell/hush_test/hush-z_slow/leak_empty_tick.right
Normal file
@ -0,0 +1,3 @@
|
||||
Warm up
|
||||
Measuring memory leak...
|
||||
Ok
|
28
shell/hush_test/hush-z_slow/leak_empty_tick.tests
Executable file
28
shell/hush_test/hush-z_slow/leak_empty_tick.tests
Executable file
@ -0,0 +1,28 @@
|
||||
echo "Warm up"
|
||||
i=1
|
||||
while test $i != 9; do
|
||||
`true`
|
||||
: $((i++))
|
||||
done
|
||||
|
||||
memleak
|
||||
|
||||
echo "Measuring memory leak..."
|
||||
i=1
|
||||
while test $i != 199; do
|
||||
`true`
|
||||
: $((i++))
|
||||
done
|
||||
i=1
|
||||
while test $i != 199; do
|
||||
`true`
|
||||
: $((i++))
|
||||
done
|
||||
|
||||
memleak
|
||||
kb=$?
|
||||
if test $kb -le 4; then
|
||||
echo Ok #$kb
|
||||
else
|
||||
echo "Bad: $kb kb (or more) leaked"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user