From f02a242f673187c73ad6d4d975986277c7a0f28e Mon Sep 17 00:00:00 2001 From: Kaian Date: Fri, 2 Sep 2016 10:52:50 +0200 Subject: [PATCH] Avoid inifite loops sorting by timestamps. #141 --- src/rtp.c | 4 ++++ src/sip_msg.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/rtp.c b/src/rtp.c index bc000fc..6cb12a3 100644 --- a/src/rtp.c +++ b/src/rtp.c @@ -458,6 +458,10 @@ stream_is_older(rtp_stream_t *one, rtp_stream_t *two) if (!two) return 1; + // No, you are not older than yourself + if (one == two) + return 0; + // Otherwise return timeval_is_older(one->time, two->time); } diff --git a/src/sip_msg.c b/src/sip_msg.c index f8192a0..0f5b456 100644 --- a/src/sip_msg.c +++ b/src/sip_msg.c @@ -166,6 +166,10 @@ msg_is_older(sip_msg_t *one, sip_msg_t *two) if (!two) return 1; + // No, you are not older than yourself + if (one == two) + return 0; + // Otherwise return timeval_is_older(msg_get_time(one), msg_get_time(two)); }