-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coverity fix: pointer/resource leak #223
Conversation
@harryz2000 could we try to use |
Yes. That would be a good idea. Will make the change. |
src/mp4streamer.cpp
Outdated
@@ -996,7 +996,7 @@ AVCDescriptor* MP4Streamer::GetAVCDescriptor() | |||
if (pictureHeaderSize) | |||
free(pictureHeaderSize); | |||
|
|||
return desc; | |||
return desc.release(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make MP4Streamer::GetAVCDescriptor()
return a std::unique_ptr
and chante the rtmpmp4streamer to use a unique ptr too
src/mp4recorder.cpp
Outdated
//Add it to map | ||
videoTrack = videoTrackPtr.release(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we should modernize the whole pointer management of the tracks. So let's change the videoTracks
to be a vector of shared_ptr
s and use shared_ptrs instead of unique_ptrs for videoTrack
so the code here is easier to change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
soory for changin my mind, but let's try to modernize the whole file
@@ -130,7 +130,7 @@ void RTMPMP4Stream::doPlay(QWORD transId, std::wstring& url,RTMPMediaStream::Lis | |||
SendMetaData(meta); | |||
|
|||
//Get AVC descriptor if any | |||
desc = streamer.GetAVCDescriptor(); | |||
desc = streamer.GetAVCDescriptor().release(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make desc
in in RTMPMP4Stream a unique ptr too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this rtmpmp4stream.cpp wasn't used in any build files. Therefore, I tended to do minor changes in case the change would break anything. So I didn't optimize this file. Where was this file used? Or should we optimize it anyway? If so, we might want to add it to some cmake file to at least verify it can compile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, let's ignore it for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
No description provided.