Skip to content
Snippets Groups Projects
Commit 0977dd10 authored by Remco's avatar Remco
Browse files

fixed comments

parent 07cef069
No related branches found
No related tags found
No related merge requests found
...@@ -87,11 +87,16 @@ int main(int argc, char **argv) ...@@ -87,11 +87,16 @@ int main(int argc, char **argv)
fcntl(STDIN_FILENO, F_SETFL, flags | O_NONBLOCK); fcntl(STDIN_FILENO, F_SETFL, flags | O_NONBLOCK);
unsigned int index = 0; size_t index = 0;
char buf[1024]; char buf[1024];
while( fgets(buf, sizeof(buf), stdin) ) { while( fgets(buf, sizeof(buf), stdin) ) {
input = (char*)realloc(assembly, index + strlen(buf)); input = (char*)realloc(assembly, index + strlen(buf));
if (!input) {
printf("Failed to allocate memory.");
return 1;
}
memcpy(&input[index], buf, strlen(buf)); memcpy(&input[index], buf, strlen(buf));
index += strlen(buf); index += strlen(buf);
} }
...@@ -253,8 +258,7 @@ int main(int argc, char **argv) ...@@ -253,8 +258,7 @@ int main(int argc, char **argv)
// close Keystone instance when done // close Keystone instance when done
ks_close(ks); ks_close(ks);
if (input) free(input);
free(input);
return 0; return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment