diff --git a/gtests/net/packetdrill/parser.y b/gtests/net/packetdrill/parser.y
index 7fc2b6c6360dcdde3c83eba45ddc2615c41e8b30..8f353410b201060a80ebbcd1c7cfa2262974a2f4 100644
--- a/gtests/net/packetdrill/parser.y
+++ b/gtests/net/packetdrill/parser.y
@@ -2277,34 +2277,34 @@ pollfd
 ;
 
 opt_revents
-:                                { $$ = new_integer_expression(0, "%ld" ); }
+:                                { $$ = new_integer_expression(0, "%ld"); }
 | ',' REVENTS '=' expression     { $$ = $4; }
 ;
 
 l_onoff
 : ONOFF '=' INTEGER { 
-	if (!is_valid_s32($3)){
+	if (!is_valid_s32($3)) {
 		semantic_error("linger onoff out of range");
 	} else {
-		$$ = new_integer_expression( $3, "%ld" ); 
+		$$ = new_integer_expression($3, "%ld"); 
 	}	
 }
-| ONOFF '=' ELLIPSIS { $$ = new_expression( EXPR_ELLIPSIS ); }
+| ONOFF '=' ELLIPSIS { $$ = new_expression(EXPR_ELLIPSIS); }
 ;
 
 l_linger
 : LINGER '=' INTEGER { 
-	if (!is_valid_s32($3)){
+	if (!is_valid_s32($3)) {
 		semantic_error("linger out of range");
 	}
-	$$ = new_integer_expression( $3, "%ld");
+	$$ = new_integer_expression($3, "%ld");
 }
-| LINGER '=' ELLIPSIS { $$ = new_expression( EXPR_ELLIPSIS ); }
+| LINGER '=' ELLIPSIS { $$ = new_expression(EXPR_ELLIPSIS); }
 ;
 
 linger
 : '{' l_onoff ',' l_linger '}' {
-	$$ = new_expression( EXPR_LINGER );
+	$$ = new_expression(EXPR_LINGER);
 	$$->value.linger = (struct linger_expr*) calloc(1, sizeof(struct linger_expr));
 	$$->value.linger->l_onoff  = $2;
 	$$->value.linger->l_linger = $4;
@@ -2316,9 +2316,9 @@ srto_initial
 	if (!is_valid_u32($3)){
 		semantic_error("srto_initial out of range");
 	}
-        $$ = new_integer_expression( $3, "%u");
+        $$ = new_integer_expression($3, "%u");
 }
-| SRTO_INITIAL '=' ELLIPSIS { $$ = new_expression( EXPR_ELLIPSIS ); }
+| SRTO_INITIAL '=' ELLIPSIS { $$ = new_expression(EXPR_ELLIPSIS); }
 ;
 
 srto_max
@@ -2326,9 +2326,9 @@ srto_max
 	if (!is_valid_u32($3)) {
 		semantic_error("srto_max out of range");
 	}
-	$$ = new_integer_expression( $3, "%u");
+	$$ = new_integer_expression($3, "%u");
 }
-| SRTO_MAX '=' ELLIPSIS { $$ = new_expression( EXPR_ELLIPSIS ); }
+| SRTO_MAX '=' ELLIPSIS { $$ = new_expression(EXPR_ELLIPSIS); }
 ;
 
 srto_min
@@ -2336,9 +2336,9 @@ srto_min
 	if (!is_valid_u32($3)) {
 		semantic_error("srto_min out of range");
 	}
-	$$ = new_integer_expression( $3, "%u");
+	$$ = new_integer_expression($3, "%u");
 }
-| SRTO_MIN '=' ELLIPSIS { $$ = new_expression( EXPR_ELLIPSIS ); }
+| SRTO_MIN '=' ELLIPSIS { $$ = new_expression(EXPR_ELLIPSIS); }
 ;
 
 sctp_rtoinfo
diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c
index ccc09349425c1508fa179ae06da4267e483dabdd..3cd406a1c2d6f1b46deec6cc38e7101d7dc52afd 100644
--- a/gtests/net/packetdrill/run_system_call.c
+++ b/gtests/net/packetdrill/run_system_call.c
@@ -1586,7 +1586,7 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall,
 		live_optlen = (socklen_t)sizeof(struct linger);
 #ifdef SCTP_RTOINFO
 	} else if (val_expression->type == EXPR_SCTP_RTOINFO) {
-		live_optval = calloc(1, sizeof(struct sctp_rtoinfo));
+		live_optval = malloc(sizeof(struct sctp_rtoinfo));
 		live_optlen = (socklen_t)sizeof(struct sctp_rtoinfo);
 		((struct sctp_rtoinfo*)live_optval)->srto_assoc_id = 0;
 #endif
@@ -1764,7 +1764,7 @@ static int syscall_setsockopt(struct state *state, struct syscall_spec *syscall,
 	if (val_expression == NULL)
 		return STATUS_ERR;
 	if (val_expression->type == EXPR_LINGER) {
-		optval = malloc( sizeof( struct linger ));
+		optval = malloc(sizeof(struct linger));
 		get_s32(val_expression->value.linger->l_onoff, 
 			&(((struct linger*) optval)->l_onoff), error);
 		get_s32(val_expression->value.linger->l_linger,
@@ -1777,17 +1777,20 @@ static int syscall_setsockopt(struct state *state, struct syscall_spec *syscall,
 		optval = &optval_s32;
 #ifdef SCTP_RTOINFO
 	} else if (val_expression->type == EXPR_SCTP_RTOINFO) {
-		if (val_expression->value.sctp_rtoinfo->srto_initial->type != EXPR_INTEGER ||
-			val_expression->value.sctp_rtoinfo->srto_max->type != EXPR_INTEGER ||
-			val_expression->value.sctp_rtoinfo->srto_min->type != EXPR_INTEGER) { 
+		struct sctp_rtoinfo *rtoinfo;
+		struct sctp_rtoinfo_expr *expr_rtoinfo  = val_expression->value.sctp_rtoinfo;
+		if (expr_rtoinfo->srto_initial->type != EXPR_INTEGER ||
+			expr_rtoinfo->srto_max->type != EXPR_INTEGER ||
+			expr_rtoinfo->srto_min->type != EXPR_INTEGER) { 
 			asprintf(error, "Bad setsockopt, bad inputtype for rtoinfo");
 			return STATUS_ERR;
 		}
-		optval = malloc(sizeof(struct sctp_rtoinfo));
-		((struct sctp_rtoinfo*) optval)->srto_initial = val_expression->value.sctp_rtoinfo->srto_initial->value.num;
-		((struct sctp_rtoinfo*) optval)->srto_max = val_expression->value.sctp_rtoinfo->srto_max->value.num;
-		((struct sctp_rtoinfo*) optval)->srto_min = val_expression->value.sctp_rtoinfo->srto_min->value.num;
-		((struct sctp_rtoinfo*) optval)->srto_assoc_id = 0;
+		rtoinfo = malloc(sizeof(struct sctp_rtoinfo));
+		rtoinfo->srto_initial = expr_rtoinfo->srto_initial->value.num;
+		rtoinfo->srto_max = expr_rtoinfo->srto_max->value.num;
+		rtoinfo->srto_min = expr_rtoinfo->srto_min->value.num;
+		rtoinfo->srto_assoc_id = 0;
+		optval = rtoinfo;
 #endif
 #ifdef SCTP_INITMSG
 	} else if (val_expression->type == EXPR_SCTP_INITMSG) {