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
  • Loading branch information
vincentfretin committed May 11, 2024
1 parent 9be6a74 commit 1871337
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 1871337

Please sign in to comment.