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
450f227ea1
commit
534bb38c8a
1
NEWS
1
NEWS
@ -16,6 +16,7 @@ To be released as 0.12pre6 or 0.12rc1.
|
||||
header over that specified via the HTML meta tag.
|
||||
* bug 1084: Allow option names containing '+' and '*' in the option
|
||||
manager.
|
||||
* minor bug 1113: Fix a small memory leak if a mailcap file is malformed.
|
||||
|
||||
Bugs that should be removed from NEWS before the 0.12.0 release:
|
||||
|
||||
|
@ -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