Another problem (was Re: Error returns and repeated code, GOTOs, etc.)
- From: mike3 <mike4ty4@xxxxxxxxx>
- Date: Thu, 31 May 2012 16:46:40 -0700 (PDT)
On May 29, 11:44 pm, mike3 <mike4...@xxxxxxxxx> wrote:
<snip>
I've also noticed another problem. I've got a place where a
routine needs to _return_ a BigNum it mints inside itself.
ErrorCode MyFunc(BigNum **OutputValue)
{
...
*OutputValue = (BigNum *)malloc(sizeof(BigNum));
if(*OutputValue == NULL)
{
<duplicated err handler>
}
rv = BigNum_Initialize(*OutputValue);
if(rv != ERROR_SUCCESS)
{
<ditto>
}
...
(error handlers in here that now have to _free the alloced
memory
and not just deinit the BigNum_! What should I do about
this?)
...
}
What to do?
.
- Follow-Ups:
- Prev by Date: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.)
- Next by Date: Re: Error returns and repeated code, GOTOs, etc.
- Previous by thread: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.)
- Next by thread: Re: Another problem (was Re: Error returns and repeated code, GOTOs, etc.)
- Index(es):
Relevant Pages
|