properly free memory/close fd upon errors (Thanks xeen)

Found with the static analyzer cppcheck
This commit is contained in:
Michael Stapelberg
2011-08-31 14:44:48 +02:00
parent 69dc632a4e
commit e1631d6320
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);
if (ret == -1) {
warn("Cannot read from pipe");
FREE(converted);
return NULL;
}
read_bytes += ret;