diff options
author | 2018-08-20 15:21:34 -0400 | |
---|---|---|
committer | 2018-08-20 15:21:34 -0400 | |
commit | 99631c505097cd5b7c13b5f89711e089435cb0da (patch) | |
tree | d65d814c54985e8d09f994b0b739e08a724952b2 /swaynag/main.c | |
parent | Merge pull request #2498 from RyanDwyer/fix-jumping-views (diff) | |
parent | Fix bad-free in swaynag (diff) | |
download | sway-99631c505097cd5b7c13b5f89711e089435cb0da.tar.gz sway-99631c505097cd5b7c13b5f89711e089435cb0da.tar.zst sway-99631c505097cd5b7c13b5f89711e089435cb0da.zip |
Merge pull request #2501 from RedSoxFan/fix-bad-free-swaynag
Fix bad-free in swaynag
Diffstat (limited to 'swaynag/main.c')
-rw-r--r-- | swaynag/main.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/swaynag/main.c b/swaynag/main.c index 6b0b5236..d1a0d236 100644 --- a/swaynag/main.c +++ b/swaynag/main.c | |||
@@ -34,9 +34,10 @@ int main(int argc, char **argv) { | |||
34 | button_close->type = SWAYNAG_ACTION_DISMISS; | 34 | button_close->type = SWAYNAG_ACTION_DISMISS; |
35 | list_add(swaynag.buttons, button_close); | 35 | list_add(swaynag.buttons, button_close); |
36 | 36 | ||
37 | swaynag.details.button_details.text = strdup("Toggle Details"); | 37 | swaynag.details.button_details = |
38 | swaynag.details.button_details.type = SWAYNAG_ACTION_EXPAND; | 38 | calloc(sizeof(struct swaynag_button), 1); |
39 | 39 | swaynag.details.button_details->text = strdup("Toggle Details"); | |
40 | swaynag.details.button_details->type = SWAYNAG_ACTION_EXPAND; | ||
40 | 41 | ||
41 | char *config_path = NULL; | 42 | char *config_path = NULL; |
42 | bool debug = false; | 43 | bool debug = false; |
@@ -99,9 +100,10 @@ int main(int argc, char **argv) { | |||
99 | swaynag_types_free(types); | 100 | swaynag_types_free(types); |
100 | 101 | ||
101 | if (swaynag.details.message) { | 102 | if (swaynag.details.message) { |
102 | list_add(swaynag.buttons, &swaynag.details.button_details); | 103 | list_add(swaynag.buttons, swaynag.details.button_details); |
103 | } else { | 104 | } else { |
104 | free(swaynag.details.button_details.text); | 105 | free(swaynag.details.button_details->text); |
106 | free(swaynag.details.button_details); | ||
105 | } | 107 | } |
106 | 108 | ||
107 | wlr_log(WLR_DEBUG, "Output: %s", swaynag.type->output); | 109 | wlr_log(WLR_DEBUG, "Output: %s", swaynag.type->output); |
@@ -123,7 +125,8 @@ int main(int argc, char **argv) { | |||
123 | 125 | ||
124 | cleanup: | 126 | cleanup: |
125 | swaynag_types_free(types); | 127 | swaynag_types_free(types); |
126 | free(swaynag.details.button_details.text); | 128 | free(swaynag.details.button_details->text); |
129 | free(swaynag.details.button_details); | ||
127 | swaynag_destroy(&swaynag); | 130 | swaynag_destroy(&swaynag); |
128 | return exit_code; | 131 | return exit_code; |
129 | } | 132 | } |