projects
/
oweals
/
libubox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
blob: add blob_memdup()
[oweals/libubox.git]
/
blob.c
diff --git
a/blob.c
b/blob.c
index 928b5c5e89e1ebb29e9137db286e0c8c5121590c..e74f07fcb606b80e28c8293a9f5dae108a7140d9 100644
(file)
--- 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));
}
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;
+}