diff options
author | 2009-12-13 19:30:32 +0000 | |
---|---|---|
committer | 2009-12-13 19:30:32 +0000 | |
commit | 6afe391b58eb47ada25469fc9401f2b3984c6d37 (patch) | |
tree | fa211929ef629c36f582e0ea9a48c5b90840b167 /gnu/usr.bin/cvs/src | |
parent | repair type (diff) | |
download | wireguard-openbsd-6afe391b58eb47ada25469fc9401f2b3984c6d37.tar.xz wireguard-openbsd-6afe391b58eb47ada25469fc9401f2b3984c6d37.zip |
fix leaks found by parfait.
ok deraadt
Diffstat (limited to 'gnu/usr.bin/cvs/src')
-rw-r--r-- | gnu/usr.bin/cvs/src/buffer.c | 8 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/src/server.c | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/gnu/usr.bin/cvs/src/buffer.c b/gnu/usr.bin/cvs/src/buffer.c index 8f905450664..85178856008 100644 --- a/gnu/usr.bin/cvs/src/buffer.c +++ b/gnu/usr.bin/cvs/src/buffer.c @@ -101,9 +101,13 @@ allocate_buffer_datas () alc = ((struct buffer_data *) malloc (ALLOC_COUNT * sizeof (struct buffer_data))); - space = (char *) valloc (ALLOC_COUNT * BUFFER_DATA_SIZE); - if (alc == NULL || space == NULL) + if (alc == NULL) return; + space = (char *) valloc (ALLOC_COUNT * BUFFER_DATA_SIZE); + if (space == NULL) { + free(alc); + return; + } for (i = 0; i < ALLOC_COUNT; i++, alc++, space += BUFFER_DATA_SIZE) { alc->next = free_buffer_data; diff --git a/gnu/usr.bin/cvs/src/server.c b/gnu/usr.bin/cvs/src/server.c index 694dfb056e1..78f7a3852c2 100644 --- a/gnu/usr.bin/cvs/src/server.c +++ b/gnu/usr.bin/cvs/src/server.c @@ -355,14 +355,19 @@ create_adm_p (base_dir, dir) return ENOMEM; dir_where_cvsadm_lives = malloc (strlen (base_dir) + strlen (dir) + 100); - if (dir_where_cvsadm_lives == NULL) + if (dir_where_cvsadm_lives == NULL) { + free(p); return ENOMEM; + } /* Allocate some space for the temporary string in which we will construct filenames. */ tmp = malloc (strlen (base_dir) + strlen (dir) + 100); - if (tmp == NULL) + if (tmp == NULL) { + free(p); + free(dir_where_cvsadm_lives); return ENOMEM; + } /* We make several passes through this loop. On the first pass, @@ -1397,6 +1402,8 @@ receive_file (size, file, gzipped) pending_error = status; } } + if (filebuf != NULL) + free(filebuf); return; } |