From 57a31ef2030d3146ec1c099c1c4036efa01a3dfa Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Sun, 15 Feb 2009 12:36:02 -0800 Subject: s3 perfcount: Fix segfault with smbclient 'echo 3 foo' --- source3/modules/perfcount_test.c | 44 ++++++++++------------------------------ 1 file changed, 11 insertions(+), 33 deletions(-) (limited to 'source3/modules') 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); } -- cgit