Commit 4fd550a7 authored by Niels Möller's avatar Niels Möller
Browse files

Use correct allocation and deallocation functions.

Rev: src/alist.c:1.7
Rev: src/client.c:1.30
Rev: src/client_keyexchange.c:1.16
Rev: src/client_userauth.c:1.3
Rev: src/connection.c:1.14
Rev: src/crypto.c:1.12
Rev: src/io.c:1.22
Rev: src/keyexchange.c:1.24
Rev: src/parse.c:1.17
Rev: src/read_line.c:1.13
Rev: src/server_keyexchange.c:1.14
Rev: src/write_buffer.c:1.10
parent 3a2c1084
......@@ -177,7 +177,7 @@ static void do_linked_set(struct alist *c, int atom, void *value)
if (o->atom == atom)
{
*p = o->next;
lsh_free(o);
lsh_space_free(o);
#if ALIST_USE_SIZE
self->size--;
......
......@@ -134,7 +134,7 @@ static struct read_handler *do_line(struct line_handler **h,
verbose("\n");
/* FIXME: Cleanup properly. */
lsh_free(closure);
lsh_object_free(closure);
return new;
}
......@@ -145,7 +145,7 @@ static struct read_handler *do_line(struct line_handler **h,
werror("\n");
/* FIXME: Clean up properly */
lsh_free(closure);
lsh_object_free(closure);
*h = NULL;
return 0;
......
......@@ -105,7 +105,7 @@ static int do_handle_dh_reply(struct packet_handler *c,
/* FIXME: Return value is ignored */
(void) INSTALL_KEYS(closure->install, connection, hash);
lsh_free(hash);
lsh_object_free(hash);
connection->dispatch[SSH_MSG_KEXDH_REPLY] = connection->fail;
connection->kex_state = KEX_STATE_NEWKEYS;
......
......@@ -168,7 +168,7 @@ static int do_userauth_failure(struct packet_handler *c,
{ /* Doesn't help us */
werror("Recieved SSH_MSH_USERAUTH_FAILURE "
"indicating partial success.\n");
lsh_free(methods);
lsh_space_free(methods);
return LSH_FAIL | LSH_DIE;
}
......@@ -176,16 +176,16 @@ static int do_userauth_failure(struct packet_handler *c,
if (methods[i] == ATOM_PASSWORD)
{
/* Try again */
lsh_free(methods);
lsh_space_free(methods);
return send_passwd(closure->userauth, connection);
}
/* No methods that we can use */
lsh_free(methods);
lsh_space_free(methods);
return LSH_FAIL | LSH_DIE;
}
if (methods)
lsh_free(methods);
lsh_space_free(methods);
lsh_string_free(packet);
return LSH_FAIL | LSH_DIE;
......@@ -220,7 +220,7 @@ static int do_userauth_banner(struct packet_handler *closure,
lsh_string_free(packet);
return LSH_OK | LSH_GOON;
}
lsh_free(packet);
lsh_string_free(packet);
return LSH_FAIL | LSH_DIE;
}
......
......@@ -37,7 +37,7 @@ static int handle_connection(struct abstract_write **w,
if (msg == SSH_MSG_NEWKEYS)
{
werror("Unexpected NEWKEYS message!\n");
lsh_free(packet);
lsh_string_free(packet);
return LSH_FAIL | LSH_DIE;
}
break;
......@@ -49,7 +49,7 @@ static int handle_connection(struct abstract_write **w,
* now, we always switch to the IN_PROGRESS state, to wait for a
* KEXDH_INIT or KEXDH_REPLY message. */
closure->kex_state = KEX_STATE_IN_PROGRESS;
lsh_free(packet);
lsh_string_free(packet);
return LSH_OK | LSH_GOON;
case KEX_STATE_IN_PROGRESS:
......@@ -57,7 +57,7 @@ static int handle_connection(struct abstract_write **w,
|| (msg == SSH_MSG_KEXINIT))
{
werror("Unexpected KEXINIT or NEWKEYS message!\n");
lsh_free(packet);
lsh_string_free(packet);
return LSH_FAIL | LSH_DIE;
}
break;
......@@ -67,7 +67,7 @@ static int handle_connection(struct abstract_write **w,
{
werror("Expected NEWKEYS message, but recieved message %d!\n",
msg);
lsh_free(packet);
lsh_string_free(packet);
return LSH_FAIL | LSH_DIE;
}
break;
......
......@@ -188,11 +188,11 @@ static void do_hmac_digest(struct mac_instance *s,
MDEBUG(self);
HASH_DIGEST(h, data); /* Inner hash */
lsh_free(h);
lsh_object_free(h);
h = HASH_COPY(self->houter);
HASH_UPDATE(h, self->super.mac_size, data);
HASH_DIGEST(h, data);
lsh_free(h);
lsh_object_free(h);
self->state = HASH_COPY(self->hinner);
}
......
......@@ -108,11 +108,11 @@ static void close_fd(struct io_fd *fd)
* attempt to write to the buffer. So let gc handle it
* instead of freeing it explicitly */
#if 0
lsh_free(fd->buffer);
lsh_object_free(fd->buffer);
#endif
/* Handlers are not shared, so it should be ok to free them. */
lsh_free(fd->handler);
lsh_free(fd);
lsh_object_free(fd->handler);
lsh_object_free(fd);
}
static int io_iter(struct io_backend *b)
......@@ -197,7 +197,7 @@ static int io_iter(struct io_backend *b)
if (!CALLBACK(f->callout))
fatal("What now?");
b->callouts = f->next;
lsh_free(f);
lsh_object_free(f);
}
if (res<0)
{
......@@ -321,7 +321,7 @@ static int io_iter(struct io_backend *b)
/* In this case, it should be safe to
* deallocate the buffer immediately */
lsh_free(p->buffer);
lsh_object_free(p->buffer);
close_fd(p);
}
}
......@@ -345,7 +345,7 @@ static int io_iter(struct io_backend *b)
{
next = p->next;
close(p->fd);
lsh_free(p);
lsh_space_free(p);
}
b->listen = NULL;
b->nlisten = 0;
......@@ -356,7 +356,7 @@ static int io_iter(struct io_backend *b)
{
next = p->next;
close(p->fd);
lsh_free(p);
lsh_space_free(p);
}
b->connect = NULL;
b->nconnect = 0;
......@@ -366,7 +366,7 @@ static int io_iter(struct io_backend *b)
for (p = b->callouts; (p = next); )
{
next = p->next;
lsh_free(p);
lsh_space_free(p);
}
b->callouts = NULL;
}
......@@ -414,7 +414,7 @@ static int io_iter(struct io_backend *b)
"but failed before writing anything.\n");
close(fd->fd);
UNLINK_FD;
lsh_free(fd);
lsh_object_free(fd);
continue;
}
}
......@@ -432,7 +432,7 @@ static int io_iter(struct io_backend *b)
"but failed before writing anything.\n");
b->nconnect--;
UNLINK_FD;
lsh_free(fd);
lsh_object_free(fd);
continue;
}
}
......
......@@ -77,7 +77,7 @@ static struct kexinit *parse_kexinit(struct lsh_string *packet)
if (!parse_octets(&buffer, 16, res->cookie))
{
lsh_free(res);
lsh_object_free(res);
return NULL;
}
......@@ -96,8 +96,8 @@ static struct kexinit *parse_kexinit(struct lsh_string *packet)
/* Bad format */
int j;
for (j = 0; j<i; j++)
lsh_free(lists[i]);
lsh_free(res);
lsh_space_free(lists[i]);
lsh_object_free(res);
return NULL;
}
......@@ -335,7 +335,7 @@ static struct lsh_string *kex_make_key(struct hash_instance *secret,
fatal("Not implemented\n");
memcpy(key->data, digest, key_length);
lsh_free(hash);
lsh_object_free(hash);
debug_hex(key->length, key->data);
return key;
......@@ -438,7 +438,7 @@ static int do_handle_newkeys(struct packet_handler *c,
connection->dispatch[SSH_MSG_NEWKEYS] = NULL;
lsh_free(closure);
lsh_object_free(closure);
return LSH_OK | LSH_GOON;
}
else
......
......@@ -258,7 +258,7 @@ int *parse_atom_list(struct simple_buffer *buffer)
case 1:
continue;
case 0:
lsh_free(res);
lsh_space_free(res);
return NULL;
default:
fatal("Internal error\n");
......
......@@ -136,7 +136,7 @@ static int do_read_line(struct read_handler **h,
}
}
/* No data left */
lsh_free(closure);
lsh_object_free(closure);
*h = next;
return LSH_OK | LSH_GOON;
}
......
......@@ -100,7 +100,7 @@ static int do_handle_dh_init(struct packet_handler *c,
/* FIXME: Return value is ignored */
(void) INSTALL_KEYS(closure->install, connection, hash);
lsh_free(hash);
lsh_object_free(hash);
connection->kex_state = KEX_STATE_NEWKEYS;
connection->dispatch[SSH_MSG_KEXDH_INIT] = connection->fail;
......
......@@ -146,7 +146,7 @@ int write_buffer_pre_write(struct write_buffer *buffer)
buffer->head->prev = 0;
else
buffer->tail = 0;
lsh_free(n);
lsh_space_free(n);
}
else
break;
......@@ -171,6 +171,8 @@ struct write_buffer *write_buffer_alloc(UINT32 size)
res->block_size = size;
res->buffer = lsh_space_alloc(2 * size);
res->empty = 1;
res->closed = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment