Fixes use-after-free issue.

Calling writer() might fail in which case launch_buff gets freed.
This patch prevents the subsequent use of memory after it was freed.
This commit is contained in:
Daniel J. Hofmann 2014-05-10 16:01:44 +02:00 committed by ridiculousfish
parent 18c1b12741
commit 706286c289

View File

@ -1190,6 +1190,12 @@ static void launch(char *filter, const string_list_t &files, size_t fileno)
writer('&');
writer('\0');
/*
Calling writer might fail in which case launch_buff gets freed.
*/
if (error)
return;
if (system(launch_buff) == -1)
{
fprintf(stderr, _(ERROR_SYSTEM), MIMEDB, launch_buff);