@@ -131,11 +131,11 @@ impl<'a> Process<'a> {
131
131
pub fn current_dir ( & self ) -> String {
132
132
unsafe {
133
133
#[ cfg( target_os = "linux" ) ]
134
- CStr :: from_ptr ( _frida_g_get_current_dir ( ) )
135
- . to_string_lossy ( )
136
- . to_string ( )
134
+ let dir = _frida_g_get_current_dir ( ) ;
137
135
#[ cfg( not( target_os = "linux" ) ) ]
138
- CStr :: from_ptr ( _g_get_current_dir ( ) )
136
+ let dir = _g_get_current_dir ( ) ;
137
+
138
+ CStr :: from_ptr ( dir)
139
139
. to_string_lossy ( )
140
140
. to_string ( )
141
141
}
@@ -145,11 +145,11 @@ impl<'a> Process<'a> {
145
145
pub fn tmp_dir ( & self ) -> String {
146
146
unsafe {
147
147
#[ cfg( target_os = "linux" ) ]
148
- CStr :: from_ptr ( _frida_g_get_tmp_dir ( ) )
149
- . to_string_lossy ( )
150
- . to_string ( )
148
+ let dir = _frida_g_get_tmp_dir ( ) ;
151
149
#[ cfg( not( target_os = "linux" ) ) ]
152
- CStr :: from_ptr ( _g_get_tmp_dir ( ) )
150
+ let dir = _g_get_tmp_dir ( ) ;
151
+
152
+ CStr :: from_ptr ( dir)
153
153
. to_string_lossy ( )
154
154
. to_string ( )
155
155
}
@@ -159,11 +159,11 @@ impl<'a> Process<'a> {
159
159
pub fn home_dir ( & self ) -> String {
160
160
unsafe {
161
161
#[ cfg( target_os = "linux" ) ]
162
- CStr :: from_ptr ( _frida_g_get_home_dir ( ) )
163
- . to_string_lossy ( )
164
- . to_string ( )
162
+ let dir = _frida_g_get_home_dir ( ) ;
165
163
#[ cfg( not( target_os = "linux" ) ) ]
166
- CStr :: from_ptr ( _g_get_home_dir ( ) )
164
+ let dir = _g_get_home_dir ( ) ;
165
+
166
+ CStr :: from_ptr ( dir)
167
167
. to_string_lossy ( )
168
168
. to_string ( )
169
169
}
0 commit comments