1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

s3 perfcount: Fix segfault with smbclient 'echo 3 foo'

This commit is contained in:
Tim Prouty 2009-02-15 12:36:02 -08:00
parent 6bd7e2b097
commit 57a31ef203

View File

@ -227,11 +227,8 @@ static void perfcount_test_add(struct smb_perfcount_data *pcd)
(struct perfcount_test_context *)pcd->context; (struct perfcount_test_context *)pcd->context;
struct perfcount_test_counter *ctr; struct perfcount_test_counter *ctr;
if (pcd->context == NULL) { if (pcd->context == NULL)
DEBUG(0,("perfcount_test_add - uninitialized "
"perfcount context - %p\n", pcd));
return; return;
}
ctr = SMB_MALLOC_P(struct perfcount_test_counter); ctr = SMB_MALLOC_P(struct perfcount_test_counter);
if (!ctr) { if (!ctr) {
@ -247,11 +244,8 @@ static void perfcount_test_set_op(struct smb_perfcount_data *pcd, int op)
struct perfcount_test_context *ctxt = struct perfcount_test_context *ctxt =
(struct perfcount_test_context *)pcd->context; (struct perfcount_test_context *)pcd->context;
if (pcd->context == NULL) { if (pcd->context == NULL)
DEBUG(0,("perfcount_test_set_op - uninitialized "
"perfcount context - %p\n", pcd));
return; return;
}
ctxt->ops->op = op; ctxt->ops->op = op;
} }
@ -261,11 +255,8 @@ static void perfcount_test_set_subop(struct smb_perfcount_data *pcd, int sub_op)
struct perfcount_test_context *ctxt = struct perfcount_test_context *ctxt =
(struct perfcount_test_context *)pcd->context; (struct perfcount_test_context *)pcd->context;
if (pcd->context == NULL) { if (pcd->context == NULL)
DEBUG(0,("perfcount_test_set_sub_op - uninitialized "
"perfcount context - %p\n", pcd));
return; return;
}
ctxt->ops->sub_op = sub_op; ctxt->ops->sub_op = sub_op;
} }
@ -274,11 +265,9 @@ static void perfcount_test_set_ioctl(struct smb_perfcount_data *pcd, int io_ctl)
{ {
struct perfcount_test_context *ctxt = struct perfcount_test_context *ctxt =
(struct perfcount_test_context *)pcd->context; (struct perfcount_test_context *)pcd->context;
if (pcd->context == NULL) { if (pcd->context == NULL)
DEBUG(0,("perfcount_test_set_ioctl - uninitialized "
"perfcount context - %p\n", pcd));
return; return;
}
ctxt->ops->ioctl = io_ctl; ctxt->ops->ioctl = io_ctl;
} }
@ -287,11 +276,9 @@ static void perfcount_test_set_msglen_in(struct smb_perfcount_data *pcd,
{ {
struct perfcount_test_context *ctxt = struct perfcount_test_context *ctxt =
(struct perfcount_test_context *)pcd->context; (struct perfcount_test_context *)pcd->context;
if (pcd->context == NULL) { if (pcd->context == NULL)
DEBUG(0,("perfcount_test_set_msglen_in - "
"uninitialized perfcount context - %p\n", pcd));
return; return;
}
ctxt->ops->bytes_in = bytes_in; ctxt->ops->bytes_in = bytes_in;
} }
@ -301,11 +288,8 @@ static void perfcount_test_set_msglen_out(struct smb_perfcount_data *pcd,
struct perfcount_test_context *ctxt = struct perfcount_test_context *ctxt =
(struct perfcount_test_context *)pcd->context; (struct perfcount_test_context *)pcd->context;
if (pcd->context == NULL) { if (pcd->context == NULL)
DEBUG(0,("perfcount_test_set_msglen_out - uninitialized "
"perfcount context - %p\n", pcd));
return; return;
}
ctxt->ops->bytes_out = bytes_out; ctxt->ops->bytes_out = bytes_out;
} }
@ -318,11 +302,7 @@ static void perfcount_test_defer_op(struct smb_perfcount_data *pcd,
struct smb_perfcount_data *def_pcd) struct smb_perfcount_data *def_pcd)
{ {
/* we don't do anything special to deferred ops */ /* we don't do anything special to deferred ops */
if (pcd->context == NULL) { return;
DEBUG(0,("perfcount_test_set_msglen_out - uninitialized "
"perfcount context - %p\n", pcd));
return;
}
} }
static void perfcount_test_set_client(struct smb_perfcount_data *pcd, static void perfcount_test_set_client(struct smb_perfcount_data *pcd,
@ -337,15 +317,13 @@ static void perfcount_test_end(struct smb_perfcount_data *pcd)
{ {
struct perfcount_test_context *ctxt = struct perfcount_test_context *ctxt =
(struct perfcount_test_context *)pcd->context; (struct perfcount_test_context *)pcd->context;
if (pcd->context == NULL) { if (pcd->context == NULL)
DEBUG(0,("perfcount_test_end - uninitialized "
"perfcount context - %p\n", pcd));
return; return;
}
/* @bug - we don't store outbytes right for chained cmds */ /* @bug - we don't store outbytes right for chained cmds */
perfcount_test_add_counters(ctxt); perfcount_test_add_counters(ctxt);
perfcount_test_dump_counters(); perfcount_test_dump_counters();
pcd->context = NULL;
SAFE_FREE(ctxt); SAFE_FREE(ctxt);
} }