mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
mailcap bug 1113: Don't leak values of duplicate fields
If a mailcap entry has two test commands or two descriptions, free the first one before replacing it with the second one.
This commit is contained in:
parent
f735bfbe72
commit
9e4d7d1883
1
NEWS
1
NEWS
@ -46,6 +46,7 @@ Miscellaneous:
|
||||
terminal charset, and ELinks 0.12pre5 was the first release that
|
||||
supported UTF-8 as the dump charset.)
|
||||
* Really retry forever when connection.retries = 0.
|
||||
* minor bug 1113: Fix a small memory leak if a mailcap file is malformed.
|
||||
* enhancement: Session-specific options. Any options changed with
|
||||
toggle-* actions no longer affect other tabs or other terminals.
|
||||
* Do not crash when document.browse.minimum_refresh_time = 0 and
|
||||
|
@ -289,7 +289,11 @@ parse_optional_fields(struct mailcap_entry *entry, unsigned char *line)
|
||||
entry->copiousoutput = 1;
|
||||
|
||||
} else if (!c_strncasecmp(field, "test", 4)) {
|
||||
entry->testcommand = get_mailcap_field_text(field + 4);
|
||||
/* Don't leak memory if a corrupted mailcap
|
||||
* file has multiple test commands in the same
|
||||
* line. */
|
||||
mem_free_set(&entry->testcommand,
|
||||
get_mailcap_field_text(field + 4));
|
||||
if (!entry->testcommand)
|
||||
return 0;
|
||||
|
||||
@ -301,7 +305,8 @@ parse_optional_fields(struct mailcap_entry *entry, unsigned char *line)
|
||||
}
|
||||
|
||||
} else if (!c_strncasecmp(field, "description", 11)) {
|
||||
entry->description = get_mailcap_field_text(field + 11);
|
||||
mem_free_set(&entry->description,
|
||||
get_mailcap_field_text(field + 11));
|
||||
if (!entry->description)
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user