i3-nagbar: Fix small leak

This commit is contained in:
Orestis Floros 2019-10-14 12:26:10 +03:00
parent a3f94783e5
commit ffde51e50f
No known key found for this signature in database
GPG Key ID: A09DBD7D3222C1C3
1 changed files with 3 additions and 1 deletions

View File

@ -384,10 +384,11 @@ int main(int argc, char *argv[]) {
while ((o = getopt_long(argc, argv, options_string, long_options, &option_index)) != -1) { while ((o = getopt_long(argc, argv, options_string, long_options, &option_index)) != -1) {
switch (o) { switch (o) {
case 'v': case 'v':
free(pattern);
printf("i3-nagbar " I3_VERSION "\n"); printf("i3-nagbar " I3_VERSION "\n");
return 0; return 0;
case 'f': case 'f':
FREE(pattern); free(pattern);
pattern = sstrdup(optarg); pattern = sstrdup(optarg);
break; break;
case 'm': case 'm':
@ -398,6 +399,7 @@ int main(int argc, char *argv[]) {
bar_type = (strcasecmp(optarg, "warning") == 0 ? TYPE_WARNING : TYPE_ERROR); bar_type = (strcasecmp(optarg, "warning") == 0 ? TYPE_WARNING : TYPE_ERROR);
break; break;
case 'h': case 'h':
free(pattern);
printf("i3-nagbar " I3_VERSION "\n"); printf("i3-nagbar " I3_VERSION "\n");
printf("i3-nagbar [-m <message>] [-b <button> <action>] [-B <button> <action>] [-t warning|error] [-f <font>] [-v]\n"); printf("i3-nagbar [-m <message>] [-b <button> <action>] [-B <button> <action>] [-t warning|error] [-f <font>] [-v]\n");
return 0; return 0;