Skip to content

Commit

Permalink
Merge pull request #2 from gerbert/wip/optimize-free-call
Browse files Browse the repository at this point in the history
Optimize free() call
  • Loading branch information
gerbert authored Jan 12, 2023
2 parents 7521bcd + b29d74f commit 6de1d15
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ void convert(void *value) {
break;
}

free(ptr);

if (ret <= UINT32_MAX) {
switch (mode) {
case MODE_DEC_HEX:
Expand Down Expand Up @@ -197,12 +199,9 @@ void convert(void *value) {
printf("Error: Integer overflow");
}

if (os_GetKey() == k_Quit) {
free(ptr);
if (os_GetKey() == k_Quit)
return;
}

free(ptr);
// Return back
convert(value);
}

0 comments on commit 6de1d15

Please sign in to comment.