mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Cleanup: fix warning in unix.c
The compiler complained about assigning the "const char *" returned by mb_cstring() to a "char *". The warning is correct, as the returned buffer still belongs to the membuffer. The code only worked because destruction of the membuffer was "forgotten". Fix this by using the "detach_buffer()" function, which passes ownership to the caller and accordingly returns a "char *". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
f2c45c8187
commit
a781d3a44e
1 changed files with 2 additions and 1 deletions
|
@ -48,7 +48,8 @@ void subsurface_user_info(struct user_info *user)
|
|||
struct membuffer mb = {};
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
put_format(&mb, "%s@%s", username, hostname);
|
||||
user->email = mb_cstring(&mb); // 'email' is heap allocated
|
||||
mb_cstring(&mb);
|
||||
user->email = detach_buffer(&mb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue