1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

libdm: add test for dm_task_get_message_response()

Coverity notices dm_task_get_message_response() result should be
checked for NULL which should not be passed to dm_pool_strdup().
This commit is contained in:
Zdenek Kabelac 2015-11-09 09:50:46 +01:00
parent 84303dc17a
commit 3cadc1c87e
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.111 - Version 1.02.111 -
==================================== ====================================
Test dm_task_get_message_response for !NULL in dm_stats_print_region().
Add checks for failing dm_stats_create() in dmsetup. Add checks for failing dm_stats_create() in dmsetup.
Add missing fifo close when failed to initialize client connection. Add missing fifo close when failed to initialize client connection.

View File

@ -1259,6 +1259,7 @@ char *dm_stats_print_region(struct dm_stats *dms, uint64_t region_id,
{ {
char *resp = NULL; char *resp = NULL;
struct dm_task *dmt = NULL; struct dm_task *dmt = NULL;
const char *response;
if (!_stats_bound(dms)) if (!_stats_bound(dms))
return_0; return_0;
@ -1269,7 +1270,10 @@ char *dm_stats_print_region(struct dm_stats *dms, uint64_t region_id,
if (!dmt) if (!dmt)
return_0; return_0;
resp = dm_pool_strdup(dms->mem, dm_task_get_message_response(dmt)); if (!(response = dm_task_get_message_response(dmt)))
return_0;
resp = dm_pool_strdup(dms->mem, response);
dm_task_destroy(dmt); dm_task_destroy(dmt);
if (!resp) if (!resp)