diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c index 3cc3ed9933f838e98c2cb936ebb42aa1f7e9d8e5..1530ece32e7fa25b7456409f7661f9b4b4e356bd 100644 --- a/gtests/net/packetdrill/run_system_call.c +++ b/gtests/net/packetdrill/run_system_call.c @@ -1610,6 +1610,7 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall, if (live_optlen != script_optlen) { asprintf(error, "Bad getsockopt optlen: expected: %d actual: %d", (int)script_optlen, (int)live_optlen); + free(live_optval); return STATUS_ERR; } @@ -1617,10 +1618,12 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall, struct linger *ling = live_optval; if (ling->l_onoff != val_expression->value.linger.l_onoff) { asprintf(error, "Bad getsockopt Linger onoff: expected: %d actual: %u", (int)val_expression->value.linger.l_onoff, (int)ling->l_onoff); + free(live_optval); return STATUS_ERR; } if (ling->l_linger != val_expression->value.linger.l_linger) { asprintf(error, "Bad getsockopt Linger Value: expected: %d actual: %d", (int)val_expression->value.linger.l_linger, (int)ling->l_linger); + free(live_optval); return STATUS_ERR; } #ifdef SCTP_RTOINFO @@ -1628,12 +1631,15 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall, struct sctp_rtoinfo *rtoinfo = live_optval; if (rtoinfo->srto_initial != val_expression->value.sctp_rtoinfo.srto_initial){ asprintf(error, "Bad getsockopt SCTP_RTOINFO initial: expected: %d actual: %d", (int)val_expression->value.sctp_rtoinfo.srto_initial, (int)rtoinfo->srto_initial); + free(live_optval); return STATUS_ERR; } else if (rtoinfo->srto_max != val_expression->value.sctp_rtoinfo.srto_max){ asprintf(error, "Bad getsockopt SCTP_RTOINFO SRTO_MAX: expected: %d actual: %d", (int)val_expression->value.sctp_rtoinfo.srto_max, (int)rtoinfo->srto_max); + free(live_optval); return STATUS_ERR; } else if (rtoinfo->srto_min != val_expression->value.sctp_rtoinfo.srto_min){ asprintf(error, "Bad getsockopt SCTP_RTOINFO SRTO_MIN: expected: %d actual: %d", (int)val_expression->value.sctp_rtoinfo.srto_min, (int)rtoinfo->srto_min); + free(live_optval); return STATUS_ERR; } #endif @@ -1643,34 +1649,42 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall, struct sctp_status *expected_val = &(val_expression->value.sctp_status); if (live_val->sstat_state != expected_val->sstat_state) { asprintf(error, "Bad getsockopt SCTP_STATUS state: expected: %d actual: %d ", expected_val->sstat_state, live_val->sstat_state); + free(live_optval); return STATUS_ERR; } else if (live_val->sstat_rwnd != expected_val->sstat_rwnd) { asprintf(error, "Bad getsockopt SCTP_STATUS rwnd: expected: %d actual: %d ", (int) expected_val->sstat_rwnd, (int) live_val->sstat_rwnd); + free(live_optval); return STATUS_ERR; } else if (live_val->sstat_unackdata != expected_val->sstat_unackdata) { asprintf(error, "Bad getsockopt SCTP_STATUS unackdata: expected: %d actual: %d", (int) expected_val->sstat_unackdata, (int) live_val->sstat_unackdata); + free(live_optval); return STATUS_ERR; } else if (live_val->sstat_penddata != expected_val->sstat_penddata) { asprintf(error, "Bad getsockopt SCTP_STATUS penddata: expected: %d actual: %d", (int) expected_val->sstat_penddata, (int) live_val->sstat_penddata); + free(live_optval); return STATUS_ERR; } else if (live_val->sstat_instrms != expected_val->sstat_instrms) { asprintf(error, "Bad getsockopt SCTP_STATUS instreams: expected: %d actual: %d", (int) expected_val->sstat_instrms, (int) live_val->sstat_instrms); + free(live_optval); return STATUS_ERR; } else if (live_val->sstat_outstrms != expected_val->sstat_outstrms) { asprintf(error, "Bad getsockopt SCTP_STATUS outstreams: expected: %d actual: %d", (int) expected_val->sstat_outstrms, (int) live_val->sstat_outstrms); + free(live_optval); return STATUS_ERR; } else if (live_val->sstat_fragmentation_point != expected_val->sstat_fragmentation_point){ asprintf(error, "Bad getsockopt SCTP_STATUS fragmentation point: expected: %d actual: %d", (int) expected_val->sstat_fragmentation_point, (int) live_val->sstat_fragmentation_point); + free(live_optval); return STATUS_ERR; } #endif } else { if (*(int*)live_optval != script_optval) { asprintf(error, "Bad getsockopt optval: expected: %d actual: %d", (int)script_optval, *(int*)live_optval); + free(live_optval); return STATUS_ERR; } - } + free(live_optval); return STATUS_OK; }