diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-06-01 22:54:05 +0400 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-06-01 22:54:20 +0400 |
commit | 5cfe2696f0101dc3b304dbffeefd6723b7ec8453 (patch) | |
tree | 8c5e5b6edd33a411fd7e0b77ac228af958fc6257 /blob.c | |
parent | 0608d1299546d4af1facc271a090cb2abb8c6105 (diff) |
blob: add blob_memdup()
Diffstat (limited to 'blob.c')
-rw-r--r-- | blob.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -243,3 +243,17 @@ blob_attr_equal(const struct blob_attr *a1, const struct blob_attr *a2) return !memcmp(a1, a2, blob_pad_len(a1)); } + +struct blob_attr * +blob_memdup(struct blob_attr *attr) +{ + struct blob_attr *ret; + int size = blob_pad_len(attr); + + ret = malloc(size); + if (!ret) + return NULL; + + memcpy(ret, attr, size); + return ret; +} |