mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-05-19 20:17:37 -04:00
Fix use of local mem in return value reported by cppcheck
This commit is contained in:
@@ -263,22 +263,21 @@ void VideoStream::SetupCodec( int colours, int subpixelorder, int width, int hei
|
||||
void VideoStream::SetParameters( ) {
|
||||
}
|
||||
|
||||
const char *VideoStream::MimeType( ) const {
|
||||
const char *VideoStream::MimeType() const {
|
||||
for ( unsigned int i = 0; i < sizeof (mime_data) / sizeof (*mime_data); i++ ) {
|
||||
if ( strcmp( format, mime_data[i].format ) == 0 ) {
|
||||
Debug( 1, "MimeType is \"%s\"", mime_data[i].mime_type );
|
||||
if ( strcmp(format, mime_data[i].format) == 0 ) {
|
||||
Debug(1, "MimeType is \"%s\"", mime_data[i].mime_type);
|
||||
return mime_data[i].mime_type;
|
||||
}
|
||||
}
|
||||
const char *mime_type = of->mime_type;
|
||||
if ( !mime_type ) {
|
||||
std::string mime = "video/";
|
||||
mime = mime.append( format );
|
||||
mime_type = mime.c_str( );
|
||||
Warning( "Unable to determine mime type for '%s' format, using '%s' as default", format, mime_type );
|
||||
std::string mime = std::string("video/") + format;
|
||||
mime_type = strdup(mime.c_str()); // mem leak
|
||||
Warning( "Unable to determine mime type for '%s' format, using '%s' as default", format, mime_type);
|
||||
}
|
||||
|
||||
Debug(1, "MimeType is \"%s\"", mime_type );
|
||||
Debug(1, "MimeType is \"%s\"", mime_type);
|
||||
|
||||
return mime_type;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user