mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-18 18:58:22 +00:00
test: initialize capture structure before freeing
ASTERISK-30232 #close Change-Id: I2603e2cef8f93f6b0a6ef39f7eac744251bb3902
This commit is contained in:
committed by
Friendly Automation
parent
bde816ab54
commit
a15fffa57e
@@ -313,6 +313,12 @@ void ast_test_set_result(struct ast_test *test, enum ast_test_result_state state
|
||||
test->state = state;
|
||||
}
|
||||
|
||||
void ast_test_capture_init(struct ast_test_capture *capture)
|
||||
{
|
||||
capture->outbuf = capture->errbuf = NULL;
|
||||
capture->pid = capture->exitcode = -1;
|
||||
}
|
||||
|
||||
void ast_test_capture_free(struct ast_test_capture *capture)
|
||||
{
|
||||
if (capture) {
|
||||
@@ -336,8 +342,7 @@ int ast_test_capture_command(struct ast_test_capture *capture, const char *file,
|
||||
int status = 0;
|
||||
FILE *cmd = NULL, *out = NULL, *err = NULL;
|
||||
|
||||
memset(capture, 0, sizeof(*capture));
|
||||
capture->pid = capture->exitcode = -1;
|
||||
ast_test_capture_init(capture);
|
||||
|
||||
if (data != NULL && datalen > 0) {
|
||||
if (pipe(fd0) == -1) {
|
||||
|
Reference in New Issue
Block a user