i am a little confused on something .. wondering if someone could clear this up for me...

HBRUSH hbrush;
HBRUSH old_brush;
hbrush = CreateHatchBrush(HS_FDIAGONAL,RGB(22,22,22));
old_brush = (HBRUSH)SelectObject(hdc,hbrush);
SelectObject(hdc,old_brush);
Ellipse(hdc,30,30,130,130);
DeleteObject(hbrush);


this is how i have seen it coded in tutorials and this is supposedly the proper way to free memory, etc.... but i'm not getting it..
could someone explain to me why this is the correct way?
From looking at it appears that old_brush is never freed...

this is how i thought it should be coded...

HBRUSH hbrush;
hbrush = CreateHatchBrush(HS_FDIAGONAL,RGB(22,22,22));
SelectObject(hdc,hbrush);
Ellipse(hdc,30,30,130,130);
DeleteObject(hbrush);