[CORE] Added memory check (#1638)

This commit is contained in:
Sukchan Lee 2022-07-01 21:49:31 +09:00
parent 6adf541346
commit 318fc25535
1 changed files with 3 additions and 1 deletions

View File

@ -297,8 +297,10 @@ ogs_pkbuf_t *ogs_pkbuf_copy_debug(ogs_pkbuf_t *pkbuf, const char *file_line)
{
#if OGS_USE_TALLOC
ogs_pkbuf_t *newbuf;
int size = pkbuf->end - pkbuf->head;
int size = 0;
ogs_assert(pkbuf);
size = pkbuf->end - pkbuf->head;
ogs_assert(size > 0);
newbuf = ogs_pkbuf_alloc_debug(NULL, size, file_line);
if (!newbuf) {