Skip to contentSkip to conversation

New Defects reported by Coverity Scan for XenProject

DISCUSSION Ian Campbell 2 participants 2 messages Apr 2, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Charles,

I'm not sure if this is a real issue in the qdisk support for xenstat, but I think it may relate to the first return 0 in qmp_read which may not free the accumulated array.

Could you take a look please?

Ian.

Quoted 39 lines · On Wed, 2015-04-01 at 05:51 -0700, [email protected] wrote:

Hi,

Please find the latest report on new defect(s) introduced to XenProject found with Coverity Scan.

1 new defect(s) introduced to XenProject found with Coverity Scan.
2 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)

** CID 1292691: Resource leaks (RESOURCE_LEAK) /tools/xenstat/libxenstat/src/xenstat_qmp.c: 327 in qmp_query()

________________________________________________________________________________________________________
*** CID 1292691: Resource leaks (RESOURCE_LEAK) /tools/xenstat/libxenstat/src/xenstat_qmp.c: 327 in qmp_query()
321 int n;
322

323     	n = strlen(cmd);
324     	if (qmp_write(qfd, cmd, n) != n)
325     		return NULL;
326     	if (!qmp_read(qfd, &qstats))
>>>     CID 1292691:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "qstats" going out of scope leaks the storage it points to.
327     		return NULL;
328     	return qstats;
329     }

330
331 /* Returns a socket connected to the QMP socket. Returns -1 on failure. */
332 static int qmp_connect(char *path)

________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://scan.coverity.com/projects/606?tab=overview

To manage Coverity Scan email notifications for "[email protected]", click https://scan.coverity.com/subscriptions/edit?email=ian.campbell%40citrix.com&token=1ce0fc428b9f94f66fd8d1ecf6cbb76a .

#2 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Ian Campbell

Hi Charles,

I'm not sure if this is a real issue in the qdisk support for xenstat, but I think it may relate to the first return 0 in qmp_read which may not free the accumulated array.

Yes. That is a leak on the failure case.

Quoted 2 lines

Could you take a look please?

Patch sent, Thanks

- Charles

Quoted 54 lines

Ian.

Quoted 3 lines · On Wed, 2015-04-01 at 05:51 -0700, [email protected] wrote:

Hi,

Please find the latest report on new defect(s) introduced to XenProject

found with Coverity Scan.

Quoted 3 lines

1 new defect(s) introduced to XenProject found with Coverity Scan. 2 defect(s), reported by Coverity Scan earlier, were marked fixed in the

recent build analyzed by Coverity Scan.

Quoted 10 lines

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)

** CID 1292691: Resource leaks (RESOURCE_LEAK) /tools/xenstat/libxenstat/src/xenstat_qmp.c: 327 in qmp_query()

_____________________________________________________________________________
___________________________

Quoted 13 lines

*** CID 1292691: Resource leaks (RESOURCE_LEAK) /tools/xenstat/libxenstat/src/xenstat_qmp.c: 327 in qmp_query()
321 int n;
322

323     	n = strlen(cmd);
324     	if (qmp_write(qfd, cmd, n) != n)
325     		return NULL;
326     	if (!qmp_read(qfd, &qstats))
>>>     CID 1292691:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "qstats" going out of scope leaks the storage it points to.
327     		return NULL;
328     	return qstats;
329     }
Quoted 2 lines

330
331 /* Returns a socket connected to the QMP socket. Returns -1 on

failure. */

Quoted 4 lines

332 static int qmp_connect(char *path)

_____________________________________________________________________________
___________________________

Quoted 1 line

To view the defects in Coverity Scan visit,

https://scan.coverity.com/projects/606?tab=overview

Quoted 2 lines

To manage Coverity Scan email notifications for "[email protected]",

click
https://scan.coverity.com/subscriptions/edit?email=ian.campbell%40citrix.com&t
oken=1ce0fc428b9f94f66fd8d1ecf6cbb76a .

Quoted 1 line