Skip to content

Commit 844d529

Browse files
committed
openrc-run: use static array instead of malloc(BUFSIZ)
1 parent 758b68a commit 844d529

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/openrc-run/openrc-run.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ svc_exec(const char *arg1, const char *arg2)
363363
int flags = 0;
364364
struct pollfd fd[2];
365365
int s;
366-
char *buffer;
366+
char buffer[BUFSIZ];
367367
size_t bytes;
368368
bool prefixed = false;
369369
int slave_tty;
@@ -426,7 +426,6 @@ svc_exec(const char *arg1, const char *arg2)
426426
/* UNREACHABLE */
427427
}
428428

429-
buffer = xmalloc(sizeof(char) * BUFSIZ);
430429
fd[0].fd = signal_pipe[0];
431430
fd[1].fd = master_tty;
432431
fd[0].events = fd[1].events = POLLIN;
@@ -480,8 +479,6 @@ svc_exec(const char *arg1, const char *arg2)
480479
}
481480
}
482481

483-
free(buffer);
484-
485482
sigemptyset (&sigchldmask);
486483
sigaddset (&sigchldmask, SIGCHLD);
487484
sigprocmask (SIG_BLOCK, &sigchldmask, &oldmask);

0 commit comments

Comments
 (0)