Levi Neely
8916acb4f6
Fix bad-free in psync_interval_tree_free
...
Interval tree nodes are allocated via pmem_malloc, which prepends a
16-byte header. Passing bare free() to ptree_for_each_element_call_safe
freed the wrong address. Add free_interval_tree_node() helper that uses
pmem_free and use it in psync_interval_tree_free.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 13:34:09 +01:00
Levi Neely
358ae595e9
Add memory accounting per subsystem ( #371 )
...
* Implement memory accounting infrastructure
* Migrate malloc/calloc to pmem_malloc with subsystem tracking
* Add overflow-safe pmem_malloc_array function
* Migrate pfstasks.c malloc/free to pmem_malloc/pmem_free
* Migrate pnetlibs.c malloc/free to pmem_malloc/pmem_free
* Fix multiplication patterns in pnetlibs.c with pmem_malloc_array
* Migrate ppagecache.c malloc/free to pmem_malloc/pmem_free
* Fix remaining multiplication pattern in ppagecache.c line 3239
* Migrate pssl.c malloc/free to pmem_malloc/pmem_free
* Migrate pcryptofolder.c malloc/free to pmem_malloc/pmem_free
* Migrate pfolder.c malloc/free to pmem_malloc/pmem_free
* Fix multiplication patterns in pfolder.c with overflow checks
* Migrate publiclinks.c malloc/free to pmem_malloc/pmem_free
* Migrate plocalscan.c malloc/free to pmem_malloc/pmem_free
* Migrate psql.c malloc/free to pmem_malloc/pmem_free
* Migrate putil.c malloc/free to pmem_malloc/pmem_free
* Fix multiplication patterns in putil.c encoding functions with overflow checks
* Migrate pfsupload.c malloc/free to pmem_malloc/pmem_free
* Migrate pdiff.c malloc/free to pmem_malloc/pmem_free
* Migrate pcrypto.c malloc/free to pmem_malloc/pmem_free
* Migrate pupload.c malloc/free to pmem_malloc/pmem_free
* Migrate psock.c malloc/free to pmem_malloc/pmem_free
* Fix multiplication pattern in psock.c with overflow checks
* Add panic() with backtrace to psignal module
* Register panic handlers early in main()
* Fix panic() infinite recursion by unregistering handlers before abort()
* Migrate remaining 34 files to pmem_malloc/pmem_free
* Migrate papi.c, ptools.c, pbusinessaccount.c to PMEM_SUBSYS_API
* Fix pcache.c compilation errors - replace he->pmem_free with pmem_free
* Add pmem.h include to pdbg.c
* Add pmem.h include to 10 files missing it
* Fix ptask.c compilation errors - replace s->pmem_free with s->free
* Fix ptask.c callback arguments - remove PMEM_SUBSYS_OTHER from s->free calls
* Fix pmem.c infinite recursion - use raw malloc/free internally
* Fix prand.c mixed allocation - use pmem_free for putil_strdup result
* Migrate psettings.c free() calls to pmem_free()
* Fix all remaining stray free() calls - migrate to pmem_free()
* Fix pnetlibs_debug.c free() call - migrate to pmem_free()
* Add missing pmem.h include to pdevice.c
* Migrate pclsync_lib.cpp free() calls to pmem_free()
* Fix pfolder.c psync_free_string_list to use pmem_free()
* Fix all psync_list_for_each_element_call to use pmem_free wrappers
* Fix all list free wrapper functions - add proper definitions
* Fix rpcclient.cpp mixed allocation - use pmem_free for prpc_sockpath
* Replace all realloc() calls with pmem_realloc()
* Replace all strdup() calls with putil_strdup()
* Fix rpcclient.cpp allocation boundary - use plain malloc/free for RPC responses
* Fix RPC response length calculation - include header size
* Fix control_tools.cpp mixed allocations - use pmem_free for pshm_read results
---------
Co-authored-by: Levi Neely <lkn@darkstar.example.net>
2026-03-08 21:47:22 +01:00
Levi Neely
6994a3cac9
102 create a psql namespace ( #142 )
...
* another stupid macro gone
* more stupid macros gone. moved util functions from plibs to putil
* remaining plist and ptask functions moved to appropriate namespaces
* dead code beleted!
* bugfixes
* move sql functions to psql.c
* move sort functions into ppagecache
* psql namespace
* change plibs.h include to pdbg.h
* cleanup includes
2025-03-18 19:52:15 +01:00
Levi Neely
9014edb99a
98 create a pdbg namespace ( #139 )
...
* pdbg split from plibs
* pdbg namespace
* add SSLDBGLVL build option
2025-03-13 20:28:09 +01:00
Levi Neely
9da561c767
131 remove custom memory management wrappers ( #137 )
...
* psync_free removed
* psync_malloc removed
* psync_realloc removed
* remove dead code
* remove pmemlock
* remove dead code
2025-03-11 22:27:30 +01:00
Levi Neely
1106028eba
WIP: Decompose namespaces and other cleanup ( #94 )
...
* papi namespace, remove some transient dependencies
* ptask namespace and cleanup
* pcache namespace and cleanup
* refactor pcallbacks into pqevent and ptevent
* pcryptofolder namespace and cleanup
* pcryptofolder missed a rename
* pdeflate namespace and cleanup
* pcrypto namespace
* pcrypto cleanup
* pcrypto consistency
* pcrypto more consistency
* pdevmon namespace and cleanup
* pdiff namespace
* pdownload namespace and cleanup
* pstatus namespace and cleanup
* pfileops namespace, fix header inlining abuse
* pfoldersync API, start chipping away at the psynclib monster
* pfscrypto namespace
* plocks namespace
* pnotify namespace
* pnotify formatting
* prpc namespace (got rid of confusing "overlay")
* pp2p namespace and cleanup
* ppagecache namespace
* ppassword namespace
* ppathstatus namespace
* prunratelimited => prun with throttling
* pscanner.c => psuggest namespace
* ptimer namespace
* ptools namespace (move to putil namespace someday)
* ptree namespace
* moved public link definitions into publiclinks.h, no clear namespace here though...
* pupload namespace
* formatting
* pcrc32c namespace
2025-03-01 22:21:54 +01:00
Levi Neely
bec97722cd
reorg source tree, link system mbedtls ( #38 )
...
* reorg source tree, link system mbedtls
* remove cmakelists.txt
* update ci workflow
* -Werror to -Wall
* libpcloudcc_so in makefile
* single makefile works
* removed extra makefiles
2024-08-15 19:49:57 +02:00