mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Free some allocations
This commit is contained in:
parent
82b85f20be
commit
ddb8ae12b0
@ -167,13 +167,18 @@ static int start_child_process(const char* cmd) {
|
||||
close(err[1]);
|
||||
break;
|
||||
default:
|
||||
/* perent */
|
||||
/* parent */
|
||||
close(in[0]);
|
||||
close(out[1]);
|
||||
close(err[1]);
|
||||
break;
|
||||
}
|
||||
|
||||
/* cleanup when returns from the child */
|
||||
for(int i = 0; params[i]; i++)
|
||||
free(params[i]);
|
||||
free(params);
|
||||
|
||||
int status, ret;
|
||||
errno = 0;
|
||||
if(waitpid(pid, &status, 0) < 0) {
|
||||
@ -326,12 +331,9 @@ static int start_dialog(int argc, char** argv) {
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if(argc == 1)
|
||||
if(argc <= 1)
|
||||
return start_dialog(argc, argv);
|
||||
|
||||
|
||||
|
||||
if(argc > 1) {
|
||||
/* do not see possible flags as commands */
|
||||
if(argv[1][0] == '-') {
|
||||
help();
|
||||
@ -340,6 +342,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
String args;
|
||||
unsigned int alen;
|
||||
|
||||
for(int i = 1; i < argc; i++) {
|
||||
args += argv[i];
|
||||
args += ' ';
|
||||
@ -368,7 +371,6 @@ int main(int argc, char** argv) {
|
||||
} else {
|
||||
start_child(args.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user