From: Adrian Freihofer <[email protected]> Removes the following warnings thrown by make && valgrind -s --leak-check=full ./ptest-runner -d tests/data2
==4154390== Invalid write of size 8 ==4154390== at 0x40360D: run_child (utils.c:357) ==4154390== by 0x403C5B: run_ptests (utils.c:534) ==4154390== by 0x402C4D: main (main.c:223) ==4154390== Address 0x4a66440 is 0 bytes inside a block of size 2 alloc'd ==4154390== at 0x4839809: malloc (vg_replace_malloc.c:307) ==4154390== by 0x4035E4: run_child (utils.c:354) ==4154390== by 0x403C5B: run_ptests (utils.c:534) ==4154390== by 0x402C4D: main (main.c:223) ==4154390== ==4154390== Invalid write of size 8 ==4154390== at 0x403618: run_child (utils.c:358) ==4154390== by 0x403C5B: run_ptests (utils.c:534) ==4154390== by 0x402C4D: main (main.c:223) ==4154390== Address 0x4a66448 is 6 bytes after a block of size 2 alloc'd ==4154390== at 0x4839809: malloc (vg_replace_malloc.c:307) ==4154390== by 0x4035E4: run_child (utils.c:354) ==4154390== by 0x403C5B: run_ptests (utils.c:534) ==4154390== by 0x402C4D: main (main.c:223) ==4154390== ==4154390== Syscall param execve(argv) points to unaddressable byte(s) ==4154390== at 0x4955C2B: execve (in /usr/lib64/libc-2.32.so) ==4154390== by 0x40365E: run_child (utils.c:368) ==4154390== by 0x403C5B: run_ptests (utils.c:534) ==4154390== by 0x402C4D: main (main.c:223) ==4154390== Address 0x4a66442 is 0 bytes after a block of size 2 alloc'd ==4154390== at 0x4839809: malloc (vg_replace_malloc.c:307) ==4154390== by 0x4035E4: run_child (utils.c:354) ==4154390== by 0x403C5B: run_ptests (utils.c:534) ==4154390== by 0x402C4D: main (main.c:223) Signed-off-by: Adrian Freihofer <[email protected]> --- utils.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/utils.c b/utils.c index bce9808..a23679a 100644 --- a/utils.c +++ b/utils.c @@ -351,12 +351,9 @@ read_child(void *arg) static inline void run_child(char *run_ptest, int fd_stdout, int fd_stderr) { - char **argv = malloc(sizeof(char) * 2); + char *const argv[2] = {run_ptest, NULL}; chdir(dirname(strdup(run_ptest))); - argv[0] = run_ptest; - argv[1] = NULL; - dup2(fd_stdout, STDOUT_FILENO); // XXX: Redirect stderr to stdout to avoid buffer ordering problems. dup2(fd_stdout, STDERR_FILENO); -- 2.20.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#54180): https://lists.yoctoproject.org/g/yocto/message/54180 Mute This Topic: https://lists.yoctoproject.org/mt/84352908/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
