summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-02-15 12:36:02 -0800
committerTim Prouty <tprouty@samba.org>2009-02-16 00:29:20 -0800
commit57a31ef2030d3146ec1c099c1c4036efa01a3dfa (patch)
tree18e46daf4c8b15609e1d0fad28c4911fa7037d39 /source3
parent6bd7e2b097c54615929b9fdcb7ca00a3fa4cc2aa (diff)
downloadsamba-57a31ef2030d3146ec1c099c1c4036efa01a3dfa.tar.gz
samba-57a31ef2030d3146ec1c099c1c4036efa01a3dfa.tar.bz2
samba-57a31ef2030d3146ec1c099c1c4036efa01a3dfa.zip
s3 perfcount: Fix segfault with smbclient 'echo 3 foo'
Diffstat (limited to 'source3')
-rw-r--r--source3/modules/perfcount_test.c44
1 files changed, 11 insertions, 33 deletions
diff --git a/source3/modules/perfcount_test.c b/source3/modules/perfcount_test.c
index 3221adf15c..b140172af4 100644
--- a/source3/modules/perfcount_test.c
+++ b/source3/modules/perfcount_test.c
@@ -227,11 +227,8 @@ static void perfcount_test_add(struct smb_perfcount_data *pcd)
(struct perfcount_test_context *)pcd->context;
struct perfcount_test_counter *ctr;
- if (pcd->context == NULL) {
- DEBUG(0,("perfcount_test_add - uninitialized "
- "perfcount context - %p\n", pcd));
+ if (pcd->context == NULL)
return;
- }
ctr = SMB_MALLOC_P(struct perfcount_test_counter);
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 *)pcd->context;
- if (pcd->context == NULL) {
- DEBUG(0,("perfcount_test_set_op - uninitialized "
- "perfcount context - %p\n", pcd));
+ if (pcd->context == NULL)
return;
- }
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 *)pcd->context;
- if (pcd->context == NULL) {
- DEBUG(0,("perfcount_test_set_sub_op - uninitialized "
- "perfcount context - %p\n", pcd));
+ if (pcd->context == NULL)
return;
- }
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 *)pcd->context;
- if (pcd->context == NULL) {
- DEBUG(0,("perfcount_test_set_ioctl - uninitialized "
- "perfcount context - %p\n", pcd));
+ if (pcd->context == NULL)
return;
- }
+
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 *)pcd->context;
- if (pcd->context == NULL) {
- DEBUG(0,("perfcount_test_set_msglen_in - "
- "uninitialized perfcount context - %p\n", pcd));
+ if (pcd->context == NULL)
return;
- }
+
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 *)pcd->context;
- if (pcd->context == NULL) {
- DEBUG(0,("perfcount_test_set_msglen_out - uninitialized "
- "perfcount context - %p\n", pcd));
+ if (pcd->context == NULL)
return;
- }
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)
{
/* we don't do anything special to deferred ops */
- if (pcd->context == NULL) {
- DEBUG(0,("perfcount_test_set_msglen_out - uninitialized "
- "perfcount context - %p\n", pcd));
- return;
- }
+ return;
}
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 *)pcd->context;
- if (pcd->context == NULL) {
- DEBUG(0,("perfcount_test_end - uninitialized "
- "perfcount context - %p\n", pcd));
+ if (pcd->context == NULL)
return;
- }
/* @bug - we don't store outbytes right for chained cmds */
perfcount_test_add_counters(ctxt);
perfcount_test_dump_counters();
+ pcd->context = NULL;
SAFE_FREE(ctxt);
}