From bf514fb2a0e0dd68c3b41e5f20e2408b55823ddc Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 8 Nov 2017 17:15:09 +0100 Subject: [PATCH] TT#24097 Do not directly return result from sort Using sort on a scalar context has undefined behavior. Assign the result of the sort into an array and return that. Change-Id: I180ba1dfcafe6e49132a38bd01be715718a4dff1 --- perl/NGCP/Rtpclient/ICE.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/perl/NGCP/Rtpclient/ICE.pm b/perl/NGCP/Rtpclient/ICE.pm index c3c062c3e..775873324 100644 --- a/perl/NGCP/Rtpclient/ICE.pm +++ b/perl/NGCP/Rtpclient/ICE.pm @@ -795,7 +795,10 @@ sub keepalives { sub sort_pairs { my ($pair_list) = @_; - return sort {$a->priority() <=> $b->priority()} @$pair_list; + my @sorted_list = sort { + $a->priority() <=> $b->priority() + } @{$pair_list}; + return @sorted_list; } sub get_send_component {