Skip to content

Commit

Permalink
fix co_free memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
leiffyli authored Jun 14, 2017
1 parent b4c4d69 commit eb75d36
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions co_routine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,16 @@ int co_create( stCoRoutine_t **ppco,const stCoRoutineAttr_t *attr,pfn_co_routine
}
void co_free( stCoRoutine_t *co )
{
free( co );
if (!co->cIsShareStack)
{
free(co->stack_mem->stack_buffer);
free(co->stack_mem);
}
free( co );
}
void co_release( stCoRoutine_t *co )
{
if( co->cEnd )
{
free( co );
}
co_free( co );
}

void co_swap(stCoRoutine_t* curr, stCoRoutine_t* pending_co);
Expand Down

0 comments on commit eb75d36

Please sign in to comment.