Fix leak of url found by cppcheck.

This commit is contained in:
Michael Drake 2014-04-02 21:04:00 +01:00
parent a9fb42e71b
commit 979b59887f

View File

@ -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);