You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by "PengZheng (via GitHub)" <gi...@apache.org> on 2024/02/13 15:27:07 UTC

[I] Memory Leaks Caused By realloc Failure (celix)

PengZheng opened a new issue, #730:
URL: https://github.com/apache/celix/issues/730

   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:
   
   ```C
       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.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Memory Leaks Caused By realloc Failure (celix)

Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng closed issue #730: Memory Leaks Caused By realloc Failure
URL: https://github.com/apache/celix/issues/730


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org