summaryrefslogtreecommitdiff
path: root/source3/libsmb/pylibsmb.c
diff options
context:
space:
mode:
authorChristian Ambach <ambi@samba.org>2012-09-16 00:15:21 +0200
committerChristian Ambach <ambi@samba.org>2012-09-16 22:31:38 +0200
commit57990cbcbbdf83d7b9997ac1fd33528c63c96226 (patch)
tree0d3535613628264de9755fd2532406768dc5383c /source3/libsmb/pylibsmb.c
parent7a6182962966e5edb42728c8d0a4d471a69c83d7 (diff)
downloadsamba-57990cbcbbdf83d7b9997ac1fd33528c63c96226.tar.gz
samba-57990cbcbbdf83d7b9997ac1fd33528c63c96226.tar.bz2
samba-57990cbcbbdf83d7b9997ac1fd33528c63c96226.zip
s3:libsmb fix a potential crash
Signed-off-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Christian Ambach <ambi@samba.org> Autobuild-Date(master): Sun Sep 16 22:31:38 CEST 2012 on sn-devel-104
Diffstat (limited to 'source3/libsmb/pylibsmb.c')
-rw-r--r--source3/libsmb/pylibsmb.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index d8e64b3568..611d07abae 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -166,7 +166,7 @@ static int py_cli_thread_destructor(struct py_cli_thread *t)
static bool py_cli_state_setup_ev(struct py_cli_state *self)
{
- struct py_cli_thread *t;
+ struct py_cli_thread *t = NULL;
int ret;
self->ev = tevent_context_init_byname(NULL, "poll_mt");
@@ -202,15 +202,18 @@ static bool py_cli_state_setup_ev(struct py_cli_state *self)
return true;
fail:
- TALLOC_FREE(t->shutdown_fde);
+ if (t != NULL) {
+ TALLOC_FREE(t->shutdown_fde);
- if (t->shutdown_pipe[0] != -1) {
- close(t->shutdown_pipe[0]);
- t->shutdown_pipe[0] = -1;
- }
- if (t->shutdown_pipe[1] != -1) {
- close(t->shutdown_pipe[1]);
- t->shutdown_pipe[1] = -1;
+ if (t->shutdown_pipe[0] != -1) {
+ close(t->shutdown_pipe[0]);
+ t->shutdown_pipe[0] = -1;
+ }
+ if (t->shutdown_pipe[1] != -1) {
+ close(t->shutdown_pipe[1]);
+ t->shutdown_pipe[1] = -1;
+ }
+ TALLOC_FREE(t);
}
TALLOC_FREE(self->thread_state);