mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-08-19 04:07:35 +00:00
shared: free dt (temporary dir name) on fail
[zj: modified to not to try to rmdir() dir we haven't created.]
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
ebf4fb3d36
commit
f36a783ca7
+4
-2
@@ -5708,7 +5708,7 @@ int create_tmp_dir(char template[], char** dir_name) {
|
||||
dt = strjoin(d, "/tmp", NULL);
|
||||
if (!dt) {
|
||||
r = log_oom();
|
||||
goto fail2;
|
||||
goto fail3;
|
||||
}
|
||||
|
||||
umask(0000);
|
||||
@@ -5716,7 +5716,7 @@ int create_tmp_dir(char template[], char** dir_name) {
|
||||
if (r) {
|
||||
log_error("Can't create directory %s: %m", dt);
|
||||
r = -errno;
|
||||
goto fail1;
|
||||
goto fail2;
|
||||
}
|
||||
log_debug("Created temporary directory %s", dt);
|
||||
|
||||
@@ -5734,6 +5734,8 @@ int create_tmp_dir(char template[], char** dir_name) {
|
||||
fail1:
|
||||
rmdir(dt);
|
||||
fail2:
|
||||
free(dt);
|
||||
fail3:
|
||||
rmdir(template);
|
||||
return r;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user