Merge branch 'fix-leaks'

This commit is contained in:
Michael Stapelberg 2011-08-31 14:45:11 +02:00
commit a65b5fd910
3 changed files with 6 additions and 1 deletions

View File

@ -188,6 +188,7 @@ static char *migrate_config(char *input, off_t size) {
ret = read(readpipe[0], converted + read_bytes, conv_size - read_bytes); ret = read(readpipe[0], converted + read_bytes, conv_size - read_bytes);
if (ret == -1) { if (ret == -1) {
warn("Cannot read from pipe"); warn("Cannot read from pipe");
FREE(converted);
return NULL; return NULL;
} }
read_bytes += ret; read_bytes += ret;

View File

@ -59,8 +59,10 @@ static bool mkdirp(const char *path) {
copy[strlen(copy)-1] = '\0'; copy[strlen(copy)-1] = '\0';
char *sep = strrchr(copy, '/'); char *sep = strrchr(copy, '/');
if (sep == NULL) if (sep == NULL) {
FREE(copy);
return false; return false;
}
*sep = '\0'; *sep = '\0';
bool result = false; bool result = false;
if (mkdirp(copy)) if (mkdirp(copy))

View File

@ -374,11 +374,13 @@ char *store_restart_layout() {
if (n == -1) { if (n == -1) {
perror("write()"); perror("write()");
free(filename); free(filename);
close(fd);
return NULL; return NULL;
} }
if (n == 0) { if (n == 0) {
printf("write == 0?\n"); printf("write == 0?\n");
free(filename); free(filename);
close(fd);
return NULL; return NULL;
} }
written += n; written += n;