Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the potential memory leak #71

Merged
merged 1 commit into from
Sep 16, 2018
Merged

Fix the potential memory leak #71

merged 1 commit into from
Sep 16, 2018

Conversation

furuame
Copy link
Member

@furuame furuame commented Sep 16, 2018

The potential memory leak is induced by the improper handling exception in each PoW implementation.

@furuame
Copy link
Member Author

furuame commented Sep 16, 2018

@ajblane Could you help review and test the FPGA implementation? Thanks.

src/pow_avx.c Outdated
PoW_AVX_Context *ctx = (PoW_AVX_Context *) malloc(sizeof(PoW_AVX_Context) * impl_ctx->num_max_thread);
if (!ctx) return false;
if(!ctx) return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change style back to the original.

src/pow_c.c Outdated

leave:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave might be inconsistent. Change it to something like fail, bail, etc.

src/pow_c.c Outdated
}

static bool PoWC_Context_Initialize(ImplContext *impl_ctx)
{
int nproc = get_avail_nprocs();
if(impl_ctx->num_max_thread <= 0 || nproc <= 0) return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. Check the style.

src/pow_c.c Outdated
PoW_C_Context *ctx = (PoW_C_Context *) malloc(sizeof(PoW_C_Context) * impl_ctx->num_max_thread);
if (!ctx) return false;
if(!ctx) return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. Style.

src/pow_cl.c Outdated
freeTrobject(trytes_t);
freeTrobject(last);
/* hack */
leave:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. Label naming consistency.

@jserv jserv self-requested a review September 16, 2018 04:11
@jserv jserv merged commit f879bed into dev Sep 16, 2018
@furuame furuame deleted the fix-memory-leak branch September 17, 2018 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants