From 979b59887f6e868908519640fc795db0070371f7 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 2 Apr 2014 21:04:00 +0100 Subject: [PATCH] Fix leak of url found by cppcheck. --- riscos/gui.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/riscos/gui.c b/riscos/gui.c index 4f9856b83..05325c572 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -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);