chunk_t *chunk_dup(const chunk_t *pc_in) { chunk_t *pc = new chunk_t; /* Allocate a new chunk */ if (pc == NULL) { /* @todo clean up properly before crashing */ LOG_FMT(LERR, "Failed to allocate memory\n"); exit(EXIT_FAILURE); } /* Copy all fields and then init the entry */ *pc = *pc_in; g_cl.InitEntry(pc); return(pc); }
chunk_t *chunk_dup(const chunk_t *pc_in) { chunk_t *pc = new chunk_t; // Allocate a new chunk if (pc == nullptr) { // @todo clean up properly before crashing LOG_FMT(LERR, "Failed to allocate memory\n"); exit(EXIT_FAILURE); } // Copy all fields and then init the entry *pc = *pc_in; // TODO: what happens if pc_in == nullptr? g_cl.InitEntry(pc); return(pc); }