Skip to content
Snippets Groups Projects
Commit 91fe3de6 authored by Michael Tüxen's avatar Michael Tüxen
Browse files

Don't check optval when getsockopt() failed.

Don't check optval in getsockopt() when it call failed.
The value makes no sense.
While there, fix a memomry leak.
parent b7ebbd27
No related branches found
No related tags found
No related merge requests found
...@@ -3456,6 +3456,7 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall, ...@@ -3456,6 +3456,7 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall,
live_result = getsockopt(live_fd, level, optname, live_optval, &live_optlen); live_result = getsockopt(live_fd, level, optname, live_optval, &live_optlen);
if (end_syscall(state, syscall, CHECK_EXACT, live_result, error)) { if (end_syscall(state, syscall, CHECK_EXACT, live_result, error)) {
free(live_optval);
return STATUS_ERR; return STATUS_ERR;
} }
...@@ -3466,6 +3467,11 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall, ...@@ -3466,6 +3467,11 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall,
return STATUS_ERR; return STATUS_ERR;
} }
if (live_result != 0) {
free(live_optval);
return STATUS_OK;
}
switch (val_expression->type) { switch (val_expression->type) {
case EXPR_LINGER: case EXPR_LINGER:
result = check_linger(val_expression->value.linger, live_optval, error); result = check_linger(val_expression->value.linger, live_optval, error);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment