summary refs log tree commit diff stats
path: root/scripts/coverity-model.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/coverity-model.c')
-rw-r--r--scripts/coverity-model.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/coverity-model.c b/scripts/coverity-model.c
index bde7411094..ee5bf9d078 100644
--- a/scripts/coverity-model.c
+++ b/scripts/coverity-model.c
@@ -236,6 +236,23 @@ void *g_try_realloc(void *ptr, size_t size)
     return g_try_realloc_n(ptr, 1, size);
 }
 
+/* Other memory allocation functions */
+
+void *g_memdup(const void *ptr, unsigned size)
+{
+    unsigned char *dup;
+    unsigned i;
+
+    if (!ptr) {
+        return NULL;
+    }
+
+    dup = g_malloc(size);
+    for (i = 0; i < size; i++)
+        dup[i] = ((unsigned char *)ptr)[i];
+    return dup;
+}
+
 /*
  * GLib string allocation functions
  */