Changeset 67


Ignore:
Timestamp:
Sep 5, 2007, 11:24:34 AM (18 years ago)
Author:
Paul Smedley
Message:

Fix for problem with handling of cli structure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/samba/source/ndpsmb/smbcd.c

    r46 r67  
    699699        }
    700700        pipe = (HPIPE)arg;
    701         rc = DosAllocMem((PPVOID)&cli, smbwrp_getclisize(), PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_ANY);
    702         if (rc)
    703         {
    704                 rc = DosAllocMem((PPVOID)&cli, smbwrp_getclisize(), PAG_COMMIT | PAG_READ | PAG_WRITE);
    705         }
    706701        cli = (cli_state *)calloc(smbwrp_getclisize(), 1);
    707         if (rc || !cli)
     702        if (!cli)
    708703        {
    709704                debuglocal(0,"Not enough memory to initialize client structure\n");
     705                DosDisConnectNPipe(pipe);
    710706                DosClose(pipe);
    711707                return;
    712708        }
    713         memset(cli, 0, smbwrp_getclisize());
    714709        debuglocal(0,"opening client pipe %d\n", pipe);
    715710        for (;;)
     
    736731                        debuglocal(0,"shutdown client %d with rc %d\n", pipe, rc);
    737732                        break;
    738                 // YD this seems to make PMView to show thumbnails faster,
    739                 // no delay shown while using FOC.
    740                 DosSleep(0);
    741733                }
    742734                // YD this seems to make PMView to show thumbnails faster,
    743735                // no delay shown while using FOC.
    744736                DosSleep(0);
     737                if (req.request == SMBREQ_DISCONNECT)
     738                {
     739                        /* The cli structure was deallocated. Reallocate it. */
     740                        cli = (cli_state *)calloc(smbwrp_getclisize(), 1);
     741                        if (!cli)
     742                        {
     743                                debuglocal(0,"Not enough memory to initialize client structure\n");
     744                                break;
     745                        }
     746                }
    745747        }
    746748        debuglocal(0,"closing client pipe %d\n", pipe);
    747749        DosDisConnectNPipe(pipe);
    748750        DosClose(pipe);
    749         memset(cli, 0, smbwrp_getclisize());
    750         DosFreeMem(cli);
    751751}
    752752
Note: See TracChangeset for help on using the changeset viewer.