Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
1be84c6c
Commit
1be84c6c
authored
Oct 05, 2015
by
Sidharth Kapur
Browse files
Use glib malloc instead of malloc
parent
c0306b87
Changes
1
Hide whitespace changes
Inline
Side-by-side
zathura/zathura.c
View file @
1be84c6c
...
...
@@ -556,13 +556,13 @@ get_window_title_filename(zathura_t* zathura, const char* file_path)
girara_setting_get
(
zathura
->
ui
.
session
,
"window-title-home-tilde"
,
&
home_tilde
);
if
(
home_tilde
)
{
char
*
home
=
getenv
(
"HOME"
);
in
t
home_len
=
home
?
strlen
(
home
)
:
0
;
in
t
file_path_len
=
file_path
?
strlen
(
file_path
)
:
0
;
size_
t
home_len
=
home
?
strlen
(
home
)
:
0
;
size_
t
file_path_len
=
file_path
?
strlen
(
file_path
)
:
0
;
if
(
home_len
>
1
&&
strncmp
(
home
,
file_path
,
home_len
)
==
0
&&
(
!
file_path
[
home_len
]
||
file_path
[
home_len
]
==
'/'
))
{
// Length should be total length of path - length of $HOME + 1 for '~' + 1 for '\0'
int
tlen
=
file_path_len
-
home_len
+
2
;
char
*
tdir
=
malloc
(
sizeof
(
char
)
*
tlen
);
char
*
tdir
=
g_try_
malloc
(
sizeof
(
char
)
*
tlen
);
strncpy
(
tdir
+
1
,
file_path
+
home_len
,
tlen
);
tdir
[
0
]
=
'~'
;
tdir
[
tlen
-
1
]
=
'\0'
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment