1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-02 00:22:11 +03:00

r2628: got rid of some warnings and converted a few more places to use hierarchical memory allocation

This commit is contained in:
Andrew Tridgell
2004-09-25 11:48:30 +00:00
committed by Gerald (Jerry) Carter
parent 76d0b8206c
commit 26da45a801
8 changed files with 17 additions and 15 deletions

View File

@ -612,7 +612,7 @@ static void ldapsrv_accept(struct server_connection *conn)
DEBUG(5, ("ldapsrv_accept\n"));
ldap_conn = talloc_p(NULL, struct ldapsrv_connection);
ldap_conn = talloc_p(conn, struct ldapsrv_connection);
if (ldap_conn == NULL)
return;

View File

@ -153,7 +153,7 @@ static NTSTATUS ipv4_tcp_accept(struct socket_context *sock, struct socket_conte
socklen_t cli_addr_len = 0;
int new_fd;
new_fd = accept(sock->fd, &cli_addr, &cli_addr_len);
new_fd = accept(sock->fd, (struct sockaddr *)&cli_addr, &cli_addr_len);
if (new_fd == -1) {
/* TODO: we need to map from errno to NTSTATUS here! */
return NT_STATUS_FOOBAR;

View File

@ -22,8 +22,7 @@
#include "includes.h"
/* initialise a dcerpc pipe. This currently assumes a SMB named pipe
transport */
/* initialise a dcerpc pipe. */
struct dcerpc_pipe *dcerpc_pipe_init(void)
{
struct dcerpc_pipe *p;

View File

@ -433,7 +433,7 @@ NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe **p,
/* Over-ride the default session key with the SMB session key */
(*p)->security_state.session_key = smb_session_key;
smb = talloc((*p), sizeof(*smb));
smb = talloc_p((*p), struct smb_private);
if (!smb) {
dcerpc_pipe_close(*p);
return NT_STATUS_NO_MEMORY;

View File

@ -329,7 +329,7 @@ NTSTATUS dcerpc_pipe_open_tcp(struct dcerpc_pipe **p,
set_socket_options(fd, lp_socket_options());
if (!(*p = dcerpc_pipe_init())) {
if (!(*p = dcerpc_pipe_init())) {
return NT_STATUS_NO_MEMORY;
}

View File

@ -47,13 +47,13 @@ static NTSTATUS samr_Connect(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem
ZERO_STRUCTP(r->out.connect_handle);
c_state = talloc_p(NULL, struct samr_connect_state);
c_state = talloc_p(dce_call->conn, struct samr_connect_state);
if (!c_state) {
return NT_STATUS_NO_MEMORY;
}
/* make sure the sam database is accessible */
c_state->sam_ctx = samdb_connect(mem_ctx);
c_state->sam_ctx = samdb_connect(c_state);
if (c_state->sam_ctx == NULL) {
talloc_free(c_state);
return NT_STATUS_INVALID_SYSTEM_SERVICE;

View File

@ -101,9 +101,9 @@ struct server_context *server_service_startup(const char *model)
if you pass *port == 0, then a port > 1024 is used
*/
struct server_socket *service_setup_socket(struct server_service *service,
const struct model_ops *model_ops,
const char *sock_addr,
uint16_t *port)
const struct model_ops *model_ops,
const char *sock_addr,
uint16_t *port)
{
NTSTATUS status;
struct server_socket *srv_sock;
@ -155,7 +155,7 @@ struct server_socket *service_setup_socket(struct server_service *service,
return NULL;
}
srv_sock = talloc_p(NULL, struct server_socket);
srv_sock = talloc_p(service, struct server_socket);
if (!srv_sock) {
DEBUG(0,("talloc_p(mem_ctx, struct server_socket) failed\n"));
socket_destroy(socket_ctx);
@ -185,13 +185,16 @@ struct server_socket *service_setup_socket(struct server_service *service,
return srv_sock;
}
struct server_connection *server_setup_connection(struct event_context *ev, struct server_socket *server_socket, struct socket_context *sock, time_t t)
struct server_connection *server_setup_connection(struct event_context *ev,
struct server_socket *server_socket,
struct socket_context *sock,
time_t t)
{
struct fd_event fde;
struct timed_event idle;
struct server_connection *srv_conn;
srv_conn = talloc_p(NULL, struct server_connection);
srv_conn = talloc_p(server_socket, struct server_connection);
if (!srv_conn) {
DEBUG(0,("talloc_p(mem_ctx, struct server_service_connection) failed\n"));
return NULL;

View File

@ -40,7 +40,7 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree,
int i;
NTSTATUS status;
ucs_name = talloc(NULL, (1+u_name_len)*2);
ucs_name = talloc(mem_ctx, (1+u_name_len)*2);
if (!ucs_name) {
printf("Failed to create UCS2 Name - talloc() failure\n");
return NT_STATUS_NO_MEMORY;