summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.md2
-rw-r--r--src/util.rs3
2 files changed, 1 insertions, 4 deletions
diff --git a/TODO.md b/TODO.md
index 7119c8f..58d923b 100644
--- a/TODO.md
+++ b/TODO.md
@@ -34,8 +34,6 @@
- Fix timing issues with the `totp_no_pin` and `totp_pin` test cases.
- Clear passwords from memory.
- Find a nicer syntax for the `write_config` test.
-- Fix segmentation faults when freeing string literals with old Nitrokey
- versions (fixed in libnitrokey commit 7a8550d).
- Prevent construction of internal types.
- Add Storage-only examples to the `DeviceWrapper` documentation.
- Fix generic connection (`get_connected_device`).
diff --git a/src/util.rs b/src/util.rs
index d764baa..6f4fbb0 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -73,11 +73,10 @@ pub fn result_from_string(ptr: *const c_char) -> Result<String, CommandError> {
}
unsafe {
let s = owned_str_from_ptr(ptr);
+ free(ptr as *mut c_void);
if s.is_empty() {
return Err(get_last_error());
}
- // TODO: move up for newer libnitrokey versions
- free(ptr as *mut c_void);
return Ok(s);
}
}