nextcloud-desktop/src/libsync
Olivier Goffart cf3846c565
csync: refactor csync_s::error_string to avoid valgrind error
The problem here is that we were sometimes allocating the error_string with
qstrdup, which need to be released with delete[] and not free().

Simplify the code by using QString instead.

```
==7230== Mismatched free() / delete / delete []
==7230==    at 0x4C2E10B: free (vg_replace_malloc.c:530)
==7230==    by 0x57C2321: csync_s::reinitialize() (csync.cpp:247)
==7230==    by 0x548130F: OCC::SyncEngine::finalize(bool) (syncengine.cpp:1212)
==7230==    by 0x5481223: OCC::SyncEngine::handleSyncError(csync_s*, char const*) (syncengine.cpp:746)
==7230==    by 0x5483E78: OCC::SyncEngine::slotDiscoveryJobFinished(int) (syncengine.cpp:965)
==7230==    by 0x5495E34: QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<int>, void, void (OCC::SyncEngine::*)(int)>::call(void (OCC::SyncEngine::*)(int), OCC::SyncEngine*, void**) (qobjectdefs_impl.h:134)
==7230==    by 0x5495D92: void QtPrivate::FunctionPointer<void (OCC::SyncEngine::*)(int)>::call<QtPrivate::List<int>, void>(void (OCC::SyncEngine::*)(int), OCC::SyncEngine*, void**) (qobjectdefs_impl.h:167)
==7230==    by 0x5495CB5: QtPrivate::QSlotObject<void (OCC::SyncEngine::*)(int), QtPrivate::List<int>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qobjectdefs_impl.h:396)
==7230==    by 0xA9BF2E1: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==    by 0x64BE983: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.11.0)
==7230==    by 0x64C625A: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.11.0)
==7230==    by 0xA994BC8: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==  Address 0x225b2640 is 0 bytes inside a block of size 50 alloc'd
==7230==    at 0x4C2DC6F: operator new[](unsigned long) (vg_replace_malloc.c:423)
==7230==    by 0xA7E8FC8: qstrdup(char const*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==    by 0x53F5750: OCC::DiscoveryJob::remote_vio_opendir_hook(char const*, void*) (discoveryphase.cpp:666)
==7230==    by 0x57E1278: csync_vio_opendir(csync_s*, char const*) (csync_vio.cpp:39)
==7230==    by 0x57D718F: csync_ftw(csync_s*, char const*, int (*)(csync_s*, std::unique_ptr<csync_file_stat_s, std::default_delete<csync_file_stat_s> >), unsigned int) (csync_update.cpp:674)
==7230==    by 0x57C1B05: csync_update(csync_s*) (csync.cpp:109)
==7230==    by 0x53F5BCC: OCC::DiscoveryJob::start() (discoveryphase.cpp:718)
==7230==    by 0x54B8F74: OCC::DiscoveryJob::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_discoveryphase.cpp:494)
==7230==    by 0xA9BF2E1: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==    by 0x64BE983: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.11.0)
==7230==    by 0x64C625A: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.11.0)
==7230==    by 0xA994BC8: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==
```
2020-12-15 10:57:55 +01:00
..
creds Get rid of FindQt5Keychain.cmake 2020-11-02 13:19:48 +01:00
abstractnetworkjob.cpp Blacklist: remember the X-Request-ID 2020-12-15 10:57:53 +01:00
abstractnetworkjob.h Blacklist: remember the X-Request-ID 2020-12-15 10:57:53 +01:00
accessmanager.cpp Use setHeader instead of setRawHeader for the user agent 2020-10-08 05:55:47 +00:00
accessmanager.h libsync: run clang-tidy modernize-use-nullptr 2018-11-12 18:46:39 +01:00
account.cpp Get rid of FindQt5Keychain.cmake 2020-11-02 13:19:48 +01:00
account.h Placeholders: Move the placeholder option from the account to the folder 2020-12-15 10:57:48 +01:00
accountfwd.h Enable the modernize-use-using check on clang-tidy 2020-08-12 18:18:57 +02:00
bandwidthmanager.cpp Enable bugprone-narrowing-conversions clang-tidy check 2020-09-01 06:37:03 +00:00
bandwidthmanager.h Adapt code style in addition to #2300 2020-08-27 01:31:06 +02:00
capabilities.cpp Add sharePublicLinkAskOptionalPassword to Capabilities 2020-10-07 09:43:47 +00:00
capabilities.h Add sharePublicLinkAskOptionalPassword to Capabilities 2020-10-07 09:43:47 +00:00
clientproxy.cpp Fix libsync exports for proxy changes in #1886 2020-06-18 21:05:11 +02:00
clientproxy.h Fix libsync exports for proxy changes in #1886 2020-06-18 21:05:11 +02:00
clientsideencryption.cpp Get rid of FindQt5Keychain.cmake 2020-11-02 13:19:48 +01:00
clientsideencryption.h Factor out the logic to start a new e2ee status job 2020-10-21 10:00:58 +02:00
clientsideencryptionjobs.cpp Don't use depth infinity anymore to get the folders e2ee status 2020-10-21 10:00:59 +02:00
clientsideencryptionjobs.h Add a way to know which folder was listed for encrypted status 2020-10-21 10:00:58 +02:00
CMakeLists.txt LocalDiscoveryTracker: Separate from Folder and move to libsync 2020-12-15 10:57:51 +01:00
configfile.cpp Settings migration: Preserve future settings where possible 2020-12-15 10:57:54 +01:00
configfile.h Settings migration: Preserve future settings where possible 2020-12-15 10:57:54 +01:00
cookiejar.cpp Enable the modernize-loop-convert check on clang-tidy 2020-08-13 12:55:14 +00:00
cookiejar.h libsync: run clang-tidy modernize-use-nullptr 2018-11-12 18:46:39 +01:00
discoveryphase.cpp csync: refactor csync_s::error_string to avoid valgrind error 2020-12-15 10:57:55 +01:00
discoveryphase.h Remove remaining QLinkedList includes in addition to #2300 2020-08-27 03:12:09 +02:00
encryptfolderjob.cpp Delete a space character 2020-07-01 14:10:49 +02:00
encryptfolderjob.h Move the encrypt folder logic in a reusable job class 2020-06-30 11:29:08 +02:00
filesystem.cpp FileSystem: make removeRecursively() reusable 2020-10-22 16:39:17 +02:00
filesystem.h SocketAPI: Introduce conflict resolution actions #6252 2020-10-22 16:40:10 +02:00
libsync.md Structure developer documentation 2015-06-29 18:43:21 +02:00
localdiscoverytracker.cpp LocalDiscoveryTracker: Separate from Folder and move to libsync 2020-12-15 10:57:51 +01:00
localdiscoverytracker.h LocalDiscoveryTracker: Separate from Folder and move to libsync 2020-12-15 10:57:51 +01:00
logger.cpp Logger: Guard zlib usage by ZLIB_FOUND 2020-12-15 10:57:51 +01:00
logger.h Expose more of the logger state 2020-10-07 13:33:20 +00:00
networkjobs.cpp Enable the bugprone-branch-clone clang-tidy check 2020-09-01 06:37:03 +00:00
networkjobs.h Allow to pass extraHeaders to a path based MkColJob 2020-07-09 16:22:54 +02:00
nextcloudtheme.cpp Replace "https://..." hint by "https://host:port" 2020-05-23 18:32:18 +02:00
nextcloudtheme.h Show URL placeholder hint in wizard 2020-05-23 18:32:15 +02:00
owncloudpropagator.cpp Rename Placeholders to Virtual Files in code #6531 2020-12-15 10:57:53 +01:00
owncloudpropagator.h Rename Placeholders to Virtual Files in code #6531 2020-12-15 10:57:53 +01:00
owncloudpropagator_p.h Add error category for http file lock error status 423. 2019-06-11 23:32:10 +02:00
progressdispatcher.cpp Enable bugprone-narrowing-conversions clang-tidy check 2020-09-01 06:37:03 +00:00
progressdispatcher.h Use default member init when applicable 2020-06-03 16:10:39 +02:00
propagatedownload.cpp PropagateDownload: Don't discard the body of error message 2020-12-15 10:57:55 +01:00
propagatedownload.h libsync: run clang-tidy modernize-use-nullptr 2018-11-12 18:46:39 +01:00
propagatedownloadencrypted.cpp Deal properly with encrypted item updates accross connections 2020-07-01 16:58:29 +00:00
propagatedownloadencrypted.h Take care of mangled paths on download as well 2020-06-30 11:29:08 +02:00
propagateremotedelete.cpp Blacklist: remember the X-Request-ID 2020-12-15 10:57:53 +01:00
propagateremotedelete.h Prevent parallelism when deleting encrypted files 2020-07-09 16:22:54 +02:00
propagateremotedeleteencrypted.cpp Stop unlocking from within PropagateRemoteDeleteEncrypted 2020-07-09 16:22:54 +02:00
propagateremotedeleteencrypted.h Stop unlocking from within PropagateRemoteDeleteEncrypted 2020-07-09 16:22:54 +02:00
propagateremotemkdir.cpp Blacklist: remember the X-Request-ID 2020-12-15 10:57:53 +01:00
propagateremotemkdir.h Allow to override the parallelism 2020-07-15 13:05:11 +02:00
propagateremotemove.cpp Blacklist: remember the X-Request-ID 2020-12-15 10:57:53 +01:00
propagateremotemove.h libsync: run clang-tidy modernize-use-nullptr 2018-11-12 18:46:39 +01:00
propagateupload.cpp Blacklist: remember the X-Request-ID 2020-12-15 10:57:53 +01:00
propagateupload.h Enable bugprone-narrowing-conversions clang-tidy check 2020-09-01 06:37:03 +00:00
propagateuploadencrypted.cpp Use httpd/unix-directory mimetype for E2EE folders 2020-08-31 10:08:48 +00:00
propagateuploadencrypted.h Fix parenting issues of PropagateUploadEncrypted 2020-06-30 11:29:08 +02:00
propagateuploadng.cpp Blacklist: remember the X-Request-ID 2020-12-15 10:57:53 +01:00
propagateuploadv1.cpp Blacklist: remember the X-Request-ID 2020-12-15 10:57:53 +01:00
propagatorjobs.cpp Placeholders: Safe migration to older client versions 2020-12-15 10:57:48 +01:00
propagatorjobs.h Take care of mangled paths on download as well 2020-06-30 11:29:08 +02:00
syncengine.cpp csync: refactor csync_s::error_string to avoid valgrind error 2020-12-15 10:57:55 +01:00
syncengine.h Download: Remove useless code and add a test 2020-12-15 10:57:50 +01:00
syncfileitem.cpp Remove table for e2e and add an e2eMangledName column (#169) 2018-02-12 12:50:51 +01:00
syncfileitem.h Blacklist: remember the X-Request-ID 2020-12-15 10:57:53 +01:00
syncfilestatus.cpp Enable the modernize-use-equals-default check on clang-tidy 2020-08-13 14:19:42 +02:00
syncfilestatus.h Use default member init when applicable 2020-06-03 16:10:39 +02:00
syncfilestatustracker.cpp Make sure we don't assert when calling fileStatus 2020-08-18 13:52:28 +02:00
syncfilestatustracker.h Enable the modernize-use-using check on clang-tidy 2020-08-12 18:18:57 +02:00
syncoptions.h Rename Placeholders to Virtual Files in code #6531 2020-12-15 10:57:53 +01:00
syncresult.cpp Enable the modernize-use-equals-default check on clang-tidy 2020-08-13 14:19:42 +02:00
syncresult.h Use default member init when applicable 2020-06-03 16:10:39 +02:00
theme.cpp Use dynamic path for account online/offline state icon. Refresh GUI on connection state change. 2020-11-23 17:49:25 +02:00
theme.h Use dynamic path for account online/offline state icon. Refresh GUI on connection state change. 2020-11-23 17:49:25 +02:00
wordlist.cpp Enable bugprone-narrowing-conversions clang-tidy check 2020-09-01 06:37:03 +00:00
wordlist.h Export the WordList functions 2020-10-08 15:58:29 +02:00