diff options
author | Nicholas Tay <nick@windblume.net> | 2021-12-02 18:28:05 +1100 |
---|---|---|
committer | Nicholas Tay <nick@windblume.net> | 2021-12-02 18:28:05 +1100 |
commit | 53346266b603caa37a2d516d13697867e04767d6 (patch) | |
tree | 76922045f6a80bdc26eda6cd7e5a2acbddd8f8b7 /passgen.c | |
parent | 5ae662b1af35bb0935dd2afd509d3fb73e39bf5d (diff) | |
download | passgen-53346266b603caa37a2d516d13697867e04767d6.tar.gz passgen-53346266b603caa37a2d516d13697867e04767d6.tar.bz2 passgen-53346266b603caa37a2d516d13697867e04767d6.zip |
More explicit custom grammar flag for free()
This also allows the program to be compiled with Clang.
Diffstat (limited to 'passgen.c')
-rw-r--r-- | passgen.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -21,6 +21,7 @@ int main(int argc, char *argv[]) { + bool custom_grammar = false; char *grammar = DEFAULT_GRAMMAR; int grammar_size = sizeof(DEFAULT_GRAMMAR)-1; @@ -51,6 +52,7 @@ int main(int argc, char *argv[]) memset(grammar + (triplets * 3), '!', specials); memset(grammar + (triplets * 3) + specials, '#', numbers); //printf("Custom: %s\n", grammar); + custom_grammar = true; } char password[grammar_size+1]; @@ -76,7 +78,7 @@ int main(int argc, char *argv[]) CLASSES default: printf("ERROR: Invalid grammar character '%c'.\n", c); - if (grammar != (char*)DEFAULT_GRAMMAR) + if (custom_grammar) free(grammar); return 1; } @@ -92,7 +94,7 @@ int main(int argc, char *argv[]) } while (i != 0 && password[i] == password[i-1]); } - if (grammar != (char*)DEFAULT_GRAMMAR) + if (custom_grammar) free(grammar); printf("%s\n", password); |