[vlc-commits] [Git][videolan/vlc][master] 2 commits: picture: fix reference counting with picture_AttachNewAncillary
Rémi Denis-Courmont (@Courmisch)
gitlab at videolan.org
Wed Jun 22 18:21:57 UTC 2022
Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC
Commits:
36c456f7 by Alexandre Janniaux at 2022-06-22T17:57:16+00:00
picture: fix reference counting with picture_AttachNewAncillary
Attaching an ancillary will increment the reference count for it, so it
needs to be decreased afterwards.
Fixes #27080
- - - - -
a753099c by Alexandre Janniaux at 2022-06-22T17:57:16+00:00
test: ancillary: test picture_AttachNewAncillary
- - - - -
2 changed files:
- src/misc/picture.c
- test/src/misc/ancillary.c
Changes:
=====================================
src/misc/picture.c
=====================================
@@ -497,6 +497,8 @@ picture_AttachNewAncillary(picture_t *pic, vlc_ancillary_id id, size_t size)
return NULL;
}
+ vlc_ancillary_Release(ancillary);
+
return data;
}
=====================================
test/src/misc/ancillary.c
=====================================
@@ -90,6 +90,11 @@ int main( void )
assert(ancillary);
picture_AttachAncillary(picture, ancillary);
+ const char test3[] = "test3";
+ void *data = picture_AttachNewAncillary(picture, VLC_ANCILLARY_ID('t','s','t','3'), sizeof(test3));
+ assert(data);
+ strcpy(data, test3);
+
vlc_frame_Release(frame);
/* Check that ancillaries are copied via a picture_Clone(). */
@@ -112,6 +117,10 @@ int main( void )
assert(ancillary);
assert(strcmp("test2", vlc_ancillary_GetData(ancillary)) == 0);
+ ancillary = picture_GetAncillary(copy, VLC_ANCILLARY_ID('t','s','t','3'));
+ assert(ancillary);
+ assert(strcmp("test3", vlc_ancillary_GetData(ancillary)) == 0);
+
picture_Release(copy);
return 0;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/090b5ee9d29cbb55fd9d4d4e34c8bc33b1513d7c...a753099cec0c6f12a48d3a0821f17937c27d8228
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/090b5ee9d29cbb55fd9d4d4e34c8bc33b1513d7c...a753099cec0c6f12a48d3a0821f17937c27d8228
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list