That doesn't really work. You don't want to do XXX and then clean it up
right away, you want to allocate XXX, then allocate YYY, then allocate
ZZZ, then do something with them, then clean up and return ( or maybe
not clean up on success ), but if there is an error allocating any of
the 3, then you need to clean up the ones that succeeded already.
Jakob Eriksson wrote:
Indeed. This was my immediate thought too. Maybe
something like
this, or maybe not, but you get the idea.
DoNtXXX()
{
NSTATUS Status;
Status = NtXXX();
cleanupXXX();
return !NT_SUCCESS(Status);
}
DoNtZZZ()
{
NSTATUS Status;
Status = NtZZZ();
cleanupZZZ();
return !NT_SUCCESS(Status);
}
DoNtYYY()
{
NSTATUS Status;
Status = NtYYY();
cleanupYYY();
return !NT_SUCCESS(Status);
}
NTSTATUS DoSomething()
{
return DoNtXXX() || DoNtYYY() || DoNtZZZ();
}
_______________________________________________
Ros-dev mailing list
Ros-dev(a)reactos.com
http://reactos.com:8080/mailman/listinfo/ros-dev