Avoid double free

This commit is contained in:
simon.kagstrom 2010-03-17 20:46:43 +00:00
parent 596796287e
commit 65ad6963b1

View File

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