diff mbox series

osm_db_files.c: fix bad free

Message ID 20180806062342.3623-1-honli@redhat.com (mailing list archive)
State Not Applicable
Headers show
Series osm_db_files.c: fix bad free | expand

Commit Message

Honggang LI Aug. 6, 2018, 6:23 a.m. UTC
From: Honggang Li <honli@redhat.com>

This issue was found by Coverity.

Error: BAD_FREE (CWE-763): [#def64]
opensm-3.3.20/opensm/osm_db_pack.c:260: array_free: "osm_db_delete" frees array "guid_str".
opensm-3.3.20/opensm/osm_db_files.c:665:4: freed_arg: "free" frees parameter "p_key".

Signed-off-by: Honggang Li <honli@redhat.com>
---
 opensm/osm_db_files.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Hal Rosenstock Aug. 6, 2018, 11:53 a.m. UTC | #1
On 8/6/2018 2:23 AM, Honggang LI wrote:
> From: Honggang Li <honli@redhat.com>
> 
> This issue was found by Coverity.
> 
> Error: BAD_FREE (CWE-763): [#def64]
> opensm-3.3.20/opensm/osm_db_pack.c:260: array_free: "osm_db_delete" frees array "guid_str".
> opensm-3.3.20/opensm/osm_db_files.c:665:4: freed_arg: "free" frees parameter "p_key".
> 
> Signed-off-by: Honggang Li <honli@redhat.com>

Thanks. Applied.

-- Hal
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/opensm/osm_db_files.c b/opensm/osm_db_files.c
index 7be976bb..2e0d6a96 100644
--- a/opensm/osm_db_files.c
+++ b/opensm/osm_db_files.c
@@ -662,7 +662,6 @@  int osm_db_delete(IN osm_db_domain_t * p_domain, IN char *p_key)
 				p_key, p_domain_imp->file_name, p_prev_val);
 			res = 1;
 		} else {
-			free(p_key);
 			free(p_prev_val);
 			p_domain_imp->dirty = TRUE;
 			res = 0;