diff --git a/proof/proof/src/TProof.cxx b/proof/proof/src/TProof.cxx
index e54d9d0aab37e9d017e9619dbb3da16474a95215..f4e8d57b043b437736c4b59f1c37a8b4ac7cfd12 100644
--- a/proof/proof/src/TProof.cxx
+++ b/proof/proof/src/TProof.cxx
@@ -897,7 +897,7 @@ Int_t TProof::Init(const char *, const char *conffile,
 
    if (IsMaster()) {
       // to make UploadPackage() method work on the master as well.
-      fPackMgr = gProofServ->GetPackMgr();
+      if (gProofServ) fPackMgr = gProofServ->GetPackMgr();
    } else {
 
       TString sandbox;
diff --git a/proof/proofd/src/XrdProofConn.cxx b/proof/proofd/src/XrdProofConn.cxx
index 3ea07ba07b233046d497945982bb1c9211befc98..6ed838995df1a69bc0774b9ce399593f1ab70c72 100644
--- a/proof/proofd/src/XrdProofConn.cxx
+++ b/proof/proofd/src/XrdProofConn.cxx
@@ -1296,8 +1296,12 @@ XrdSecProtocol *XrdProofConn::Authenticate(char *plist, int plsiz)
    //
    // Prepare the parms object
    char *bpar = (char *)malloc(plsiz + 1);
-   if (bpar)
-      memcpy(bpar, plist, plsiz);
+   if (!bpar) {
+      TRACE(XERR, "unable to allocate buffer for parameters");
+      return protocol;
+   }
+
+   memcpy(bpar, plist, plsiz);
    bpar[plsiz] = 0;
    XrdSecParameters Parms(bpar, plsiz + 1);
 
diff --git a/proof/proofd/src/XrdProofSched.cxx b/proof/proofd/src/XrdProofSched.cxx
index 997c8494c02d2ac50b5674f23364017ff7712498..460622ed4387428e21837771a4d916e5dd516317 100644
--- a/proof/proofd/src/XrdProofSched.cxx
+++ b/proof/proofd/src/XrdProofSched.cxx
@@ -402,6 +402,10 @@ int XrdProofSched::GetWorkers(XrdProofdProofServ *xps,
 
    int rc = 0;
 
+   // The caller must provide a proofserv session handler
+   if (!xps)
+      return -1;
+
    TRACE(REQ, "enter: query tag: "<< ((querytag) ? querytag : ""));
 
    // Static or dynamic
diff --git a/proof/proofd/src/proofexecv.cxx b/proof/proofd/src/proofexecv.cxx
index db1ed9cf51dfe915fd758c4ff34d51713c3b2392..2576e24fa39904fe728e1ba6fd012dbfd21c6cba 100644
--- a/proof/proofd/src/proofexecv.cxx
+++ b/proof/proofd/src/proofexecv.cxx
@@ -641,11 +641,11 @@ int exportsock(rpdunix *conn)
       int natt = 1000;
       while (natt > 0 && (fd = dup(d)) <= 2) {
          if (fd != d) close(fd);
+         fd = -1;
          natt--;
       }
       if (natt <= 0 && fd <= 2) {
          Info("exportsock: ERROR: no free filedescriptor!");
-         if (fd != d) close(fd);
          close(d);
          return -1;
       }
diff --git a/proof/proofplayer/src/TProofPlayer.cxx b/proof/proofplayer/src/TProofPlayer.cxx
index 8a33e2869455b68d207e7258193bb95390d366b6..1f6419000f53dd6c33bb474af99f602508895991 100644
--- a/proof/proofplayer/src/TProofPlayer.cxx
+++ b/proof/proofplayer/src/TProofPlayer.cxx
@@ -4408,7 +4408,7 @@ Bool_t TProofPlayerSlave::HandleTimer(TTimer *)
    m << fb;
 
    // send message to client;
-   gProofServ->GetSocket()->Send(m);
+   if (gProofServ) gProofServ->GetSocket()->Send(m);
 
    delete fb;
 
diff --git a/proof/proofx/src/TXSocket.cxx b/proof/proofx/src/TXSocket.cxx
index deaf0e3434de6694612bba02893e87131a1b51ff..2836d312ec016cf70a7a488b2f29fc7d7b8364b5 100644
--- a/proof/proofx/src/TXSocket.cxx
+++ b/proof/proofx/src/TXSocket.cxx
@@ -2135,7 +2135,7 @@ Int_t TXSocket::Reconnect()
    if (gDebug > 0) {
       Info("Reconnect", "%p (c:%p, v:%d): trying to reconnect to %s (logid: %d)",
                         this, fConn, (fConn ? fConn->IsValid() : 0),
-                        fUrl.Data(), fConn->GetLogConnID());
+                        fUrl.Data(), (fConn ? fConn->GetLogConnID() : -1));
    }
 
    Int_t tryreconnect = gEnv->GetValue("TXSocket.Reconnect", 0);