Defined ntfs_realloc() and ntfs_free()
Currently memory allocations are done through ntfs_malloc() and ntfs_calloc(), but releases are done through free(3). Defining an ntfs_free() relay facilitates the debugging of memory leaks in plugins.pull/2/head
parent
76fe04d03d
commit
8fa3dd3f22
|
@ -25,6 +25,8 @@
|
|||
|
||||
void *ntfs_calloc(size_t size);
|
||||
void *ntfs_malloc(size_t size);
|
||||
void *ntfs_realloc(void *ptr, size_t size);
|
||||
void ntfs_free(void *ptr);
|
||||
|
||||
#endif /* _NTFS_MISC_H_ */
|
||||
|
||||
|
|
|
@ -59,3 +59,19 @@ void *ntfs_malloc(size_t size)
|
|||
ntfs_log_perror("Failed to malloc %lld bytes", (long long)size);
|
||||
return p;
|
||||
}
|
||||
|
||||
void *ntfs_realloc(void *ptr, size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
p = realloc(ptr, size);
|
||||
if (!p)
|
||||
ntfs_log_perror("Failed to realloc %lld bytes",
|
||||
(long long)size);
|
||||
return p;
|
||||
}
|
||||
|
||||
void ntfs_free(void *p)
|
||||
{
|
||||
free(p);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue