mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 15:06:08 +03:00
Discovery: Don't leak DiscoveryDirectoryResult in case of error
Also remove redundent Q_FUNC_INFO
This commit is contained in:
parent
d38b190317
commit
0e6a463564
1 changed files with 6 additions and 6 deletions
|
@ -553,29 +553,29 @@ csync_vio_handle_t* DiscoveryJob::remote_vio_opendir_hook (const char *url,
|
|||
{
|
||||
DiscoveryJob *discoveryJob = static_cast<DiscoveryJob*>(userdata);
|
||||
if (discoveryJob) {
|
||||
qDebug() << Q_FUNC_INFO << discoveryJob << url << "Calling into main thread...";
|
||||
qDebug() << discoveryJob << url << "Calling into main thread...";
|
||||
|
||||
DiscoveryDirectoryResult *directoryResult = new DiscoveryDirectoryResult();
|
||||
QScopedPointer<DiscoveryDirectoryResult> directoryResult(new DiscoveryDirectoryResult());
|
||||
directoryResult->code = EIO;
|
||||
|
||||
discoveryJob->_vioMutex.lock();
|
||||
const QString qurl = QString::fromUtf8(url);
|
||||
emit discoveryJob->doOpendirSignal(qurl, directoryResult);
|
||||
emit discoveryJob->doOpendirSignal(qurl, directoryResult.data());
|
||||
discoveryJob->_vioWaitCondition.wait(&discoveryJob->_vioMutex, ULONG_MAX); // FIXME timeout?
|
||||
discoveryJob->_vioMutex.unlock();
|
||||
|
||||
qDebug() << Q_FUNC_INFO << discoveryJob << url << "...Returned from main thread";
|
||||
qDebug() << discoveryJob << url << "...Returned from main thread";
|
||||
|
||||
// Upon awakening from the _vioWaitCondition, iterator should be a valid iterator.
|
||||
if (directoryResult->code != 0) {
|
||||
qDebug() << Q_FUNC_INFO << directoryResult->code << "when opening" << url << "msg=" << directoryResult->msg;
|
||||
qDebug() << directoryResult->code << "when opening" << url << "msg=" << directoryResult->msg;
|
||||
errno = directoryResult->code;
|
||||
// save the error string to the context
|
||||
discoveryJob->_csync_ctx->error_string = qstrdup( directoryResult->msg.toUtf8().constData() );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (csync_vio_handle_t*) directoryResult;
|
||||
return directoryResult.take();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue