Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
01744abf
Commit
01744abf
authored
Jun 13, 2008
by
Felix Paul Kühne
Browse files
Don't double free objects on error. Pointed by Pierre
parent
d9421a57
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/access/qtcapture.m
View file @
01744abf
...
...
@@ -86,7 +86,8 @@ vlc_module_end();
}
-
(
void
)
dealloc
{
@synchronized
(
self
)
{
@synchronized
(
self
)
{
CVBufferRelease
(
currentImageBuffer
);
currentImageBuffer
=
nil
;
}
...
...
@@ -101,7 +102,8 @@ vlc_module_end();
CVBufferRetain
(
videoFrame
);
@synchronized
(
self
)
{
@synchronized
(
self
)
{
imageBufferToRelease
=
currentImageBuffer
;
currentImageBuffer
=
videoFrame
;
currentPts
=
[
sampleBuffer
presentationTime
].
timeValue
;
...
...
@@ -113,16 +115,19 @@ vlc_module_end();
{
CVImageBufferRef
imageBuffer
;
mtime_t
pts
;
@synchronized
(
self
)
{
if
(
!
currentImageBuffer
)
return
0
;
if
(
!
currentImageBuffer
)
return
0
;
@synchronized
(
self
)
{
imageBuffer
=
CVBufferRetain
(
currentImageBuffer
);
pts
=
currentPts
;
CVPixelBufferLockBaseAddress
(
imageBuffer
,
0
);
void
*
pixels
=
CVPixelBufferGetBaseAddress
(
imageBuffer
);
memcpy
(
buffer
,
pixels
,
CVPixelBufferGetBytesPerRow
(
imageBuffer
)
*
CVPixelBufferGetHeight
(
imageBuffer
)
);
CVPixelBufferUnlockBaseAddress
(
imageBuffer
,
0
);
CVPixelBufferLockBaseAddress
(
imageBuffer
,
0
);
void
*
pixels
=
CVPixelBufferGetBaseAddress
(
imageBuffer
);
memcpy
(
buffer
,
pixels
,
CVPixelBufferGetBytesPerRow
(
imageBuffer
)
*
CVPixelBufferGetHeight
(
imageBuffer
)
);
CVPixelBufferUnlockBaseAddress
(
imageBuffer
,
0
);
}
CVBufferRelease
(
imageBuffer
);
...
...
@@ -281,9 +286,6 @@ static int Open( vlc_object_t *p_this )
return
VLC_SUCCESS
;
error:
[
input
release
];
[
p_sys
->
device
release
];
[
p_sys
->
output
release
];
[
p_sys
->
session
release
];
[
pool
release
];
free
(
p_sys
);
...
...
@@ -329,7 +331,8 @@ static int Demux( demux_t *p_demux )
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
@synchronized
(
p_sys
->
output
)
{
@synchronized
(
p_sys
->
output
)
{
p_block
->
i_pts
=
[
p_sys
->
output
copyCurrentFrameToBuffer
:
p_block
->
p_buffer
];
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment