diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2017-11-18 10:55:01 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-11-22 19:22:29 +0100 |
commit | 04f38d61d7b707c3ee29e00002380d596658395e (patch) | |
tree | cc6c2ecc100a86241cffc8b4b619c10a2aec73e1 /profile-widget/profilewidget2.cpp | |
parent | 7a99d7e5c3b297b543a9ce1ab36e337c1a8e0bf0 (diff) | |
download | subsurface-04f38d61d7b707c3ee29e00002380d596658395e.tar.gz |
Clean up system_default_filename()
In the old implementation there were two static C-style strings, filename
and path, which were initialized to NULL and filled on first call of
the function (i.e. singletons).
There is no sense in having two static variables indicating whether
this function was called previously. Moreover, there is no point
in remembering filename accross function calls, because it is not
used once path is set to a non-NULL value.
Therefore, make the filename variable non-static and calculate it only on
first invocation (as indicated by a NULL path). Moreover, free() the filename
variable after its use to fix a memory leak of the old code.
The windows code is slightly different in that the temporary filename is
not dynamically allocated.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget/profilewidget2.cpp')
0 files changed, 0 insertions, 0 deletions