mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-23 14:59:47 +03:00
Fix leak of url found by cppcheck.
This commit is contained in:
parent
a9fb42e71b
commit
979b59887f
@ -1594,6 +1594,7 @@ char *ro_gui_uri_file_parse(const char *file_name, char **uri_title)
|
||||
/* URI */
|
||||
if (!ro_gui_uri_file_parse_line(fp, line))
|
||||
goto uri_syntax_error;
|
||||
|
||||
url = strdup(line);
|
||||
if (!url) {
|
||||
warn_user("NoMemory", 0);
|
||||
@ -1603,7 +1604,7 @@ char *ro_gui_uri_file_parse(const char *file_name, char **uri_title)
|
||||
|
||||
/* title */
|
||||
if (!ro_gui_uri_file_parse_line(fp, line))
|
||||
goto uri_syntax_error;
|
||||
goto uri_free;
|
||||
if (uri_title && line[0] && ((line[0] != '*') || line[1])) {
|
||||
*uri_title = strdup(line);
|
||||
if (!*uri_title) /* non-fatal */
|
||||
@ -1613,6 +1614,9 @@ char *ro_gui_uri_file_parse(const char *file_name, char **uri_title)
|
||||
|
||||
return url;
|
||||
|
||||
uri_free:
|
||||
free(url);
|
||||
|
||||
uri_syntax_error:
|
||||
fclose(fp);
|
||||
warn_user("URIError", 0);
|
||||
|
Loading…
Reference in New Issue
Block a user