Changeset 14111


Ignore:
Timestamp:
Jul 8, 2013, 5:46:12 PM (9 years ago)
Author:
jordan
Message:

in peer-mgr.c's tr_peerMgrGetDesiredAvailable(), confirm we have a swarm pointer before using it. Probable fix for bug #5407

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r14108 r14111  
    26112611  size_t n;
    26122612  uint64_t desiredAvailable;
    2613   const tr_swarm * s = tor->swarm;
     2613  const tr_swarm * s;
     2614
     2615  assert (tr_isTorrent (tor));
    26142616
    26152617  /* common shortcuts... */
    26162618
    2617   if (tr_torrentIsSeed (s->tor))
     2619  if (tr_torrentIsSeed (tor))
    26182620    return 0;
    26192621
    26202622  if (!tr_torrentHasMetadata (tor))
     2623    return 0;
     2624
     2625  s = tor->swarm;
     2626  if (s == NULL)
    26212627    return 0;
    26222628
     
    26422648  for (i=0, n=MIN (tor->info.pieceCount, s->pieceReplicationSize); i<n; ++i)
    26432649    if (!tor->info.pieces[i].dnd && (s->pieceReplication[i] > 0))
    2644       desiredAvailable += tr_cpMissingBytesInPiece (&s->tor->completion, i);
     2650      desiredAvailable += tr_cpMissingBytesInPiece (&tor->completion, i);
    26452651
    26462652  assert (desiredAvailable <= tor->info.totalSize);
     
    33783384  time_t pieceDataTime;
    33793385  time_t time;
    3380   int speed;
     3386  unsigned int speed;
    33813387  bool doPurge;
    33823388};
Note: See TracChangeset for help on using the changeset viewer.