summaryrefslogtreecommitdiffstats
path: root/src/malloc.c
blob: a5171fa484086d68d775a4c5d4382ac419b4a823 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <string.h>

#include "macro.h"
#include "malloc.h"

void* sa_memdup(const void* p, size_t size) {
    void *r;

    sa_assert(p);

    if (!(r = sa_malloc(size)))
        return NULL;

    memcpy(r, p, size);
    return r;
}