[CDRIVER-2177] Coverity analysis defect 101516: Resource leak Created: 09/Jun/17  Updated: 28/Oct/23  Resolved: 15/Jun/17

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: 1.7.0

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Hannes Magnusson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Leak of memory or pointers to system resources

Defect 101516 (STATIC_C)
Checker RESOURCE_LEAK (subcategory none)
File: /src/mongoc/mongoc-rpc.c
Function _mongoc_rpc_compress
/src/mongoc/mongoc-rpc.c, line: 676
Assigning: "output" = storage returned from "bson_malloc0(output_length)".

       output = (char *) bson_malloc0 (output_length);

/src/mongoc/mongoc-rpc.c, line: 703
Variable "output" going out of scope leaks the storage it points to.

       return NULL;



 Comments   
Comment by Githook User [ 15/Jun/17 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-2177 memleak on compression failure
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/80925c2e9479abccecd74c243093827551494323

Generated at Wed Feb 07 21:14:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.