Skip to content

Commit

Permalink
laser: fix memleak (closes gpac#3114)
Browse files Browse the repository at this point in the history
  • Loading branch information
aureliendavid committed Feb 27, 2025
1 parent 31fa100 commit fda6d07
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/laser/lsr_dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,12 +646,14 @@ static void lsr_read_any_uri(GF_LASeRCodec *lsr, XMLRI *iri, const char *name)
len = lsr_read_vluimsbf5(lsr, "len");
if (len > gf_bs_available(lsr->bs)) {
lsr->last_error = GF_NON_COMPLIANT_BITSTREAM;
if (s) { gf_free(s); }
return;
}
len_rad = s ? (u32) strlen(s) : 0;
iri->string = (char*)gf_malloc(sizeof(char)*(len_rad+1+len+1));
if (!iri->string) {
lsr->last_error = GF_OUT_OF_MEM;
if (s) { gf_free(s); }
return;
}

Expand Down Expand Up @@ -780,7 +782,7 @@ static void lsr_read_id(GF_LASeRCodec *lsr, GF_Node *n)
XMLRI *href = (XMLRI *)gf_list_get(lsr->deferred_hrefs, i);
char *str_id = href ? href->string : NULL;
if (!str_id) return;

if (str_id[0] == '#') str_id++;
/*skip 'N'*/
str_id++;
Expand Down Expand Up @@ -888,7 +890,7 @@ static Fixed lsr_translate_coords(GF_LASeRCodec *lsr, u32 val, u32 nb_bits)

static Fixed lsr_translate_scale(GF_LASeRCodec *lsr, u32 val)
{
if (val >> (lsr->coord_bits-1) ) {
if (lsr && lsr->coord_bits && val >> (lsr->coord_bits-1) ) {
s32 neg;
if (lsr->coord_bits >= 31)
neg = (s32)val - 0x80000000;
Expand Down

0 comments on commit fda6d07

Please sign in to comment.