diff options
-rw-r--r-- | editors/sed.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/editors/sed.c b/editors/sed.c index 470220859..1054c1302 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -180,18 +180,23 @@ static void sed_free_and_close_stuff(void) | |||
180 | if (sed_cmd->sw_file) | 180 | if (sed_cmd->sw_file) |
181 | fclose(sed_cmd->sw_file); | 181 | fclose(sed_cmd->sw_file); |
182 | 182 | ||
183 | if (sed_cmd->beg_match) { | 183 | /* Used to free regexps, but now there is code |
184 | regfree(sed_cmd->beg_match); | 184 | * in get_address() which can reuse a regexp |
185 | free(sed_cmd->beg_match); | 185 | * for constructs as /regexp/cmd1;//cmd2 |
186 | } | 186 | * leading to double-frees here: |
187 | if (sed_cmd->end_match) { | 187 | */ |
188 | regfree(sed_cmd->end_match); | 188 | //if (sed_cmd->beg_match) { |
189 | free(sed_cmd->end_match); | 189 | // regfree(sed_cmd->beg_match); |
190 | } | 190 | // free(sed_cmd->beg_match); |
191 | if (sed_cmd->sub_match) { | 191 | //} |
192 | regfree(sed_cmd->sub_match); | 192 | //if (sed_cmd->end_match) { |
193 | free(sed_cmd->sub_match); | 193 | // regfree(sed_cmd->end_match); |
194 | } | 194 | // free(sed_cmd->end_match); |
195 | //} | ||
196 | //if (sed_cmd->sub_match) { | ||
197 | // regfree(sed_cmd->sub_match); | ||
198 | // free(sed_cmd->sub_match); | ||
199 | //} | ||
195 | free(sed_cmd->string); | 200 | free(sed_cmd->string); |
196 | free(sed_cmd); | 201 | free(sed_cmd); |
197 | sed_cmd = sed_cmd_next; | 202 | sed_cmd = sed_cmd_next; |