Closed PengZheng closed 7 months ago
As mentioned in https://github.com/apache/celix/pull/727#discussion_r1487909520, the following code will leak the original memory block in case of realloc failure:
realloc
seq->buf = realloc(seq->buf, (size_t)(cap * size)); if (seq->buf == NULL) { seq->cap = 0; celix_err_pushf("Error allocating memory for seq buf"); return MEM_ERROR; }
According to the manual page:
If realloc() fails, the original block is left untouched; it is not freed or moved.
As mentioned in https://github.com/apache/celix/pull/727#discussion_r1487909520, the following code will leak the original memory block in case of
realloc
failure:According to the manual page: