Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/blob.c
diff options
context:
space:
mode:
Diffstat (limited to 'blob.c')
-rw-r--r--blob.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/blob.c b/blob.c
index 928b5c5..e74f07f 100644
--- a/blob.c
+++ b/blob.c
@@ -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;
+}