Skip to content

Commit

Permalink
vis: reject invalid option names
Browse files Browse the repository at this point in the history
This should fix the ressource leak as found by CID 142510.
  • Loading branch information
martanne committed Mar 21, 2017
1 parent 000cbb0 commit 937d8a8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vis-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ static void option_free(OptionDef *opt) {

bool vis_option_register(Vis *vis, const char *names[], enum VisOption flags,
VisOptionFunction *func, void *context, const char *help) {

if (!names || !names[0])
return false;

for (const char **name = names; *name; name++) {
if (map_get(vis->options, *name))
return false;
Expand Down

0 comments on commit 937d8a8

Please sign in to comment.