util/Alloc: new library replacing GLib's g_malloc()

This commit is contained in:
Max Kellermann
2014-01-07 23:33:46 +01:00
parent 49f34fbf68
commit 27ca0db7a6
20 changed files with 209 additions and 57 deletions

View File

@@ -31,12 +31,11 @@
#include "system/fd_util.h"
#include "fs/AllocatedPath.hxx"
#include "fs/FileSystem.hxx"
#include "util/Alloc.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
#include <glib.h>
#include <string>
#include <algorithm>
@@ -79,7 +78,7 @@ public:
parent(_parent), serial(_serial),
path(AllocatedPath::Null()),
address_length(_address_length),
address((sockaddr *)g_memdup(_address, _address_length))
address((sockaddr *)xmemdup(_address, _address_length))
{
assert(_address != nullptr);
assert(_address_length > 0);
@@ -89,7 +88,7 @@ public:
OneServerSocket &operator=(const OneServerSocket &other) = delete;
~OneServerSocket() {
g_free(address);
free(address);
if (IsDefined())
Close();