Skip to content

Commit

Permalink
Fixed memory leak in janus_sdp_get_codec_pt_full, g_list_free(pts) wa…
Browse files Browse the repository at this point in the history
…s not called for early return (#3373)
  • Loading branch information
vincentfretin authored May 17, 2024
1 parent 1837c03 commit fdd90a5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/sdp-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,7 @@ int janus_sdp_get_codec_pt_full(janus_sdp *sdp, int index, const char *codec, co
pts = g_list_append(pts, GINT_TO_POINTER(pt));
} else {
/* Payload type for codec found */
g_list_free(pts);
return pt;
}
}
Expand All @@ -833,6 +834,7 @@ int janus_sdp_get_codec_pt_full(janus_sdp *sdp, int index, const char *codec, co
if(strstr(a->value, profile_id) != NULL) {
/* Found */
JANUS_LOG(LOG_VERB, "VP9 profile %s found --> %d\n", profile, pt);
g_list_free(pts);
return pt;
}
} else if(h264 && strstr(a->value, "packetization-mode=0") == NULL) {
Expand All @@ -844,6 +846,7 @@ int janus_sdp_get_codec_pt_full(janus_sdp *sdp, int index, const char *codec, co
if(strstr(a->value, profile_level_id) != NULL) {
/* Found */
JANUS_LOG(LOG_VERB, "H.264 profile %s found --> %d\n", profile, pt);
g_list_free(pts);
return pt;
}
/* Not found, try converting the profile to upper case */
Expand All @@ -853,15 +856,15 @@ int janus_sdp_get_codec_pt_full(janus_sdp *sdp, int index, const char *codec, co
if(strstr(a->value, profile_level_id) != NULL) {
/* Found */
JANUS_LOG(LOG_VERB, "H.264 profile %s found --> %d\n", profile, pt);
g_list_free(pts);
return pt;
}
}
}
ma = ma->next;
}
}
if(pts != NULL)
g_list_free(pts);
g_list_free(pts);
if(index != -1)
break;
ml = ml->next;
Expand Down

0 comments on commit fdd90a5

Please sign in to comment.