void ast_test_capture_free(struct ast_test_capture *capture)
{
if (capture) {
- free(capture->outbuf);
+ /*
+ * Need to use ast_std_free because this memory wasn't
+ * allocated by the astmm functions.
+ */
+ ast_std_free(capture->outbuf);
capture->outbuf = NULL;
- free(capture->errbuf);
+ ast_std_free(capture->errbuf);
capture->errbuf = NULL;
}
capture->pid = -1;
int fd0[2] = { -1, -1 }, fd1[2] = { -1, -1 }, fd2[2] = { -1, -1 };
pid_t pid = -1;
int status = 0;
+ FILE *cmd = NULL, *out = NULL, *err = NULL;
memset(capture, 0, sizeof(*capture));
capture->pid = capture->exitcode = -1;
exit(1);
} else {
- FILE *cmd = NULL, *out = NULL, *err = NULL;
-
char buf[BUFSIZ];
int wstatus, n, nfds;
fd_set readfds, writefds;
static char *hexstring(const unsigned char *data, unsigned datalen)
{
- char *buf = alloca(datalen * 2 + 1);
+ char *buf = ast_malloc(datalen * 2 + 1);
unsigned n;
for (n = 0; n < datalen; ++n) {
res = AST_TEST_PASS;
cleanup:
+ ast_free(args[KEY]);
ast_test_capture_free(&cap);
return res;
}
res = AST_TEST_PASS;
cleanup:
+ ast_free(args[KEY]);
ast_test_capture_free(&cap);
return res;
}