Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Mar 23, 2024
1 parent 1f14071 commit 2755bb9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 5 additions & 2 deletions games/devtest/mods/testformspec/formspec.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
local color = minetest.colorize

-- The "a" in this text is actually a cyrillic small a (\u0430)
local unsafe_url = "https://u:p@wikipediа.org:1233/heIIoll?a=b#c"

local clip_fs = [[
style_type[label,button,image_button,item_image_button,
tabheader,scrollbar,table,animated_image
,field,textarea,checkbox,dropdown;noclip=%c]
label[0,0;A clipping test]
button_url[0,1;3,0.8;clip_button;A clipping test;https://u:p@wikipediа.org:1233/heIIoll?a=b#c]
button_url[0,1;3,0.8;clip_button;A clipping test;]] .. unsafe_url .. [[]
image_button[0,2;3,0.8;testformspec_button_image.png;clip_image_button;A clipping test]
item_image_button[0,3;3,0.8;testformspec:item;clip_item_image_button;A clipping test]
tabheader[0,4.7;3,0.63;clip_tabheader;Clip,Test,Text,Tabs;1;false;false]
Expand Down Expand Up @@ -146,7 +149,7 @@ local hypertext_fs = "hypertext[0,0;11,9;hypertext;"..minetest.formspec_escape(h
local style_fs = [[
style[one_btn1;bgcolor=red;textcolor=yellow;bgcolor_hovered=orange;
bgcolor_pressed=purple]
button_url[0,0;2.5,0.8;one_btn1;Button;https://u:p@wikipediа.org:1233/heIIoll?a=b#c]
button_url[0,0;2.5,0.8;one_btn1;Button;]] .. unsafe_url .. [[]
style[one_btn2;border=false;textcolor=cyan] ]]..
"button[0,1.05;2.5,0.8;one_btn2;Text " .. color("#FF0", "Yellow") .. [[]
Expand Down
1 change: 0 additions & 1 deletion src/gui/guiOpenURL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ void GUIOpenURLMenu::regenerateGui(v2u32 screensize)
e->setTextAlignment(gui::EGUIA_UPPERLEFT, gui::EGUIA_UPPERLEFT);
e->setDrawBorder(true);
e->setDrawBackground(true);

e->setOverrideFont(mono_font);
e->drop();
}
Expand Down
9 changes: 9 additions & 0 deletions src/util/colorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ bool colorize_url(std::string &out, const std::string &url) {
if (fragment)
os << "#" << fragment;

curl_free(fragment);
curl_free(host);
curl_free(password);
curl_free(path);
curl_free(port);
curl_free(query);
curl_free(scheme);
curl_free(user);
curl_free(zoneid);
curl_url_cleanup(h);
out = os.str();
return true;
Expand Down

0 comments on commit 2755bb9

Please sign in to comment.