*: fix UB with CString usage
This commit is contained in:
@ -164,7 +164,8 @@ pub fn find(id: Id) -> Option<Codec> {
|
||||
|
||||
pub fn find_by_name(name: &str) -> Option<Codec> {
|
||||
unsafe {
|
||||
let ptr = avcodec_find_decoder_by_name(CString::new(name).unwrap().as_ptr());
|
||||
let name = CString::new(name).unwrap();
|
||||
let ptr = avcodec_find_decoder_by_name(name.as_ptr());
|
||||
|
||||
if ptr.is_null() {
|
||||
None
|
||||
|
@ -141,7 +141,8 @@ pub fn find(id: Id) -> Option<Codec> {
|
||||
|
||||
pub fn find_by_name(name: &str) -> Option<Codec> {
|
||||
unsafe {
|
||||
let ptr = avcodec_find_encoder_by_name(CString::new(name).unwrap().as_ptr());
|
||||
let name = CString::new(name).unwrap();
|
||||
let ptr = avcodec_find_encoder_by_name(name.as_ptr());
|
||||
|
||||
if ptr.is_null() {
|
||||
None
|
||||
|
Reference in New Issue
Block a user