diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2019-02-06 12:31:02 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2019-02-06 12:31:02 +0000 |
commit | 9c9d011eed674ddd7e4a0a148691887afb9e75cd (patch) | |
tree | cd45bceeed24e66e5b2838e8589d2c111cf691c6 /testcode/perf.c | |
parent | 089d83fbd0b24f957b753d440f188ddadaabf4ff (diff) |
Notes
Diffstat (limited to 'testcode/perf.c')
-rw-r--r-- | testcode/perf.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/testcode/perf.c b/testcode/perf.c index 32a5307edb158..d6d2b05298e82 100644 --- a/testcode/perf.c +++ b/testcode/perf.c @@ -513,10 +513,12 @@ qlist_grow_capacity(struct perfinfo* info) uint8_t** d = (uint8_t**)calloc(sizeof(uint8_t*), newcap); size_t* l = (size_t*)calloc(sizeof(size_t), newcap); if(!d || !l) fatal_exit("out of memory"); - memcpy(d, info->qlist_data, sizeof(uint8_t*)* - info->qlist_capacity); - memcpy(l, info->qlist_len, sizeof(size_t)* - info->qlist_capacity); + if(info->qlist_data && info->qlist_capacity) + memcpy(d, info->qlist_data, sizeof(uint8_t*)* + info->qlist_capacity); + if(info->qlist_len && info->qlist_capacity) + memcpy(l, info->qlist_len, sizeof(size_t)* + info->qlist_capacity); free(info->qlist_data); free(info->qlist_len); info->qlist_data = d; |