Don't use freed data.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Wed, 25 Oct 2006 03:06:22 +0000 (03:06 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Wed, 25 Oct 2006 03:06:22 +0000 (03:06 +0000)
git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@702 959494ce-11ee-0310-bf91-de5d638817bd

daemon/transfer.c

index 066febc..cf636e4 100644 (file)
@@ -617,6 +617,8 @@ static void filterread(struct socket *sk, struct transfer *transfer)
 static void filterexit(pid_t pid, int status, void *data)
 {
     struct transfer *transfer;
+    struct fnet *fnet;
+    wchar_t *peerid;
     
     for(transfer = transfers; transfer != NULL; transfer = transfer->next)
     {
@@ -624,13 +626,14 @@ static void filterexit(pid_t pid, int status, void *data)
        {
            transfer->filter = -1;
            killfilter(transfer);
+           fnet = transfer->fnet;
+           peerid = swcsdup(transfer->peerid);
            if(WEXITSTATUS(status))
-           {
                resettransfer(transfer);
-           } else {
+           else
                freetransfer(transfer);
-           }
-           trytransferbypeer(transfer->fnet, transfer->peerid);
+           trytransferbypeer(fnet, peerid);
+           free(peerid);
            break;
        }
     }