Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config: fix dangling pointer
Browse files Browse the repository at this point in the history
panekj committed Nov 11, 2024
1 parent 7015786 commit d55b818
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions crates/weechat/src/config/config.rs
Original file line number Diff line number Diff line change
@@ -605,10 +605,7 @@ impl Conf {

let option_name = LossyCString::new(key);

let c_value = match value {
Some(v) => LossyCString::new(v).as_ptr(),
None => ptr::null(),
};
let c_value = value.map(LossyCString::new).map(|v| v.as_ptr()).unwrap_or(ptr::null());

unsafe {
write_line(self.ptr, option_name.as_ptr(), c_value);

0 comments on commit d55b818

Please sign in to comment.