Rizin
unix-like reverse engineering framework and cli tools
zip_memdup.c File Reference
#include <stdlib.h>
#include <string.h>
#include "zipint.h"

Go to the source code of this file.

Functions

void * _zip_memdup (const void *mem, size_t len, zip_error_t *error)
 

Function Documentation

◆ _zip_memdup()

void* _zip_memdup ( const void *  mem,
size_t  len,
zip_error_t error 
)

Definition at line 41 of file zip_memdup.c.

41  {
42  void *ret;
43 
44  if (len == 0)
45  return NULL;
46 
47  ret = malloc(len);
48  if (!ret) {
50  return NULL;
51  }
52 
53  memcpy(ret, mem, len);
54 
55  return ret;
56 }
size_t len
Definition: 6502dis.c:15
#define NULL
Definition: cris-opc.c:27
void * mem
Definition: libc.cpp:91
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
ZIP_EXTERN void zip_error_set(zip_error_t *_Nullable, int, int)
Definition: zip_error.c:126
#define ZIP_ER_MEMORY
Definition: zip.h:119
void * malloc(size_t size)
Definition: malloc.c:123
void error(const char *msg)
Definition: untgz.c:593

References error(), len, malloc(), mem, memcpy(), NULL, ZIP_ER_MEMORY, and zip_error_set().

Referenced by _zip_ef_new().