Update docs and fix string allocation

The docs say you should always unref the string and NULL is never
returned.  The implementation should follow that.
This commit is contained in:
Floris Bruynooghe
2023-03-07 15:36:33 +01:00
parent 4b94eadf5e
commit eec5ae96e8
2 changed files with 12 additions and 5 deletions

View File

@@ -4171,7 +4171,7 @@ pub unsafe extern "C" fn dc_backup_provider_get_qr(
) -> *mut libc::c_char {
if provider.is_null() {
eprintln!("ignoring careless call to dc_backup_provider_qr");
return ptr::null_mut();
return "".strdup();
}
let ffi_provider = &*provider;
deltachat::qr::format_backup(&ffi_provider.provider.qr())
@@ -4185,7 +4185,7 @@ pub unsafe extern "C" fn dc_backup_provider_get_qr_svg(
) -> *mut libc::c_char {
if provider.is_null() {
eprintln!("ignoring careless call to dc_backup_provider_qr_svg()");
return ptr::null_mut();
return "".strdup();
}
let ffi_provider = &*provider;
let ctx = &*ffi_provider.context;