mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-22 11:29:24 +01:00
Avoid double free
This commit is contained in:
parent
596796287e
commit
65ad6963b1
@ -1125,11 +1125,11 @@ bool Network::AppendScreenshot(NetworkUpdatePeerInfo *pi)
|
|||||||
|
|
||||||
scr = Gui::gui->screenshot;
|
scr = Gui::gui->screenshot;
|
||||||
if (!scr)
|
if (!scr)
|
||||||
goto out_none;
|
goto out;
|
||||||
|
|
||||||
png = sdl_surface_to_png(scr, &sz);
|
png = sdl_surface_to_png(scr, &sz);
|
||||||
if (!png)
|
if (!png)
|
||||||
goto out_scr;
|
goto out;
|
||||||
if ((sz & 3) != 0)
|
if ((sz & 3) != 0)
|
||||||
sz += 4 - (sz & 3);
|
sz += 4 - (sz & 3);
|
||||||
|
|
||||||
@ -1143,10 +1143,8 @@ bool Network::AppendScreenshot(NetworkUpdatePeerInfo *pi)
|
|||||||
|
|
||||||
out = true;
|
out = true;
|
||||||
free(png);
|
free(png);
|
||||||
out_scr:
|
|
||||||
SDL_FreeSurface(scr);
|
|
||||||
out_none:
|
|
||||||
|
|
||||||
|
out:
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user