libutil: fix leaks
This commit is contained in:
parent
fa0e5d6378
commit
af392d1a76
|
@ -79,6 +79,7 @@ cp(const char *s1, const char *s2, int depth)
|
|||
if (mkdir(s2, st.st_mode) < 0 && errno != EEXIST) {
|
||||
weprintf("mkdir %s:", s2);
|
||||
cp_status = 1;
|
||||
closedir(dp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -122,15 +123,18 @@ cp(const char *s1, const char *s2, int depth)
|
|||
if (unlink(s2) < 0 && errno != ENOENT) {
|
||||
weprintf("unlink %s:", s2);
|
||||
cp_status = 1;
|
||||
fclose(f1);
|
||||
return 0;
|
||||
} else if (!(f2 = fopen(s2, "w"))) {
|
||||
weprintf("fopen %s:", s2);
|
||||
cp_status = 1;
|
||||
fclose(f1);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
weprintf("fopen %s:", s2);
|
||||
cp_status = 1;
|
||||
fclose(f1);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user