summaryrefslogtreecommitdiff
path: root/tools/lib/subcmd/help.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.com>2025-09-19 17:08:20 +0200
committerJiri Kosina <jkosina@suse.com>2025-09-19 17:08:36 +0200
commit71b28769d708f20046fc6f853cf93fb88a8b6e11 (patch)
treee579afda01909585ed70bb477233b0f4f72dabac /tools/lib/subcmd/help.c
parent1860b13beca829c056179c63530eebfec9a3efb4 (diff)
parent02d6eeedbc36d4b309d5518778071a749ef79c4e (diff)
Merge remote-tracking branch 'origin' into for-6.18/intel-thc-hid
Needed as a basisi for followup support for quicki2c advanced BIOS features. Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'tools/lib/subcmd/help.c')
-rw-r--r--tools/lib/subcmd/help.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/lib/subcmd/help.c b/tools/lib/subcmd/help.c
index 8561b0f01a24..9ef569492560 100644
--- a/tools/lib/subcmd/help.c
+++ b/tools/lib/subcmd/help.c
@@ -9,6 +9,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
+#include <assert.h>
#include "subcmd-util.h"
#include "help.h"
#include "exec-cmd.h"
@@ -82,10 +83,11 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
ci++;
cj++;
} else {
- zfree(&cmds->names[cj]);
- cmds->names[cj++] = cmds->names[ci++];
+ cmds->names[cj++] = cmds->names[ci];
+ cmds->names[ci++] = NULL;
}
} else if (cmp == 0) {
+ zfree(&cmds->names[ci]);
ci++;
ei++;
} else if (cmp > 0) {
@@ -94,12 +96,12 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
}
if (ci != cj) {
while (ci < cmds->cnt) {
- zfree(&cmds->names[cj]);
- cmds->names[cj++] = cmds->names[ci++];
+ cmds->names[cj++] = cmds->names[ci];
+ cmds->names[ci++] = NULL;
}
}
for (ci = cj; ci < cmds->cnt; ci++)
- zfree(&cmds->names[ci]);
+ assert(cmds->names[ci] == NULL);
cmds->cnt = cj;
}