From: Cristian Dumitrescu Date: Tue, 6 Oct 2020 20:37:52 +0000 (+0100) Subject: pipeline: fix memory free X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0ebe8c38a34f2a5a047ee2289adfccff896f0327;p=dpdk.git pipeline: fix memory free Coverity issue: 362796, 362804, 362819, 362836, 362858, 362865, 362869 Fixes: 3ca60ceed7 ("pipeline: add SWX pipeline specification file") Signed-off-by: Cristian Dumitrescu --- diff --git a/lib/librte_pipeline/rte_swx_pipeline_spec.c b/lib/librte_pipeline/rte_swx_pipeline_spec.c index 06e1ab4380..a4bc8226a0 100644 --- a/lib/librte_pipeline/rte_swx_pipeline_spec.c +++ b/lib/librte_pipeline/rte_swx_pipeline_spec.c @@ -35,9 +35,17 @@ struct extobj_spec { static void extobj_spec_free(struct extobj_spec *s) { + if (!s) + return; + free(s->name); + s->name = NULL; + free(s->extern_type_name); + s->extern_type_name = NULL; + free(s->pragma); + s->pragma = NULL; } static int @@ -246,8 +254,14 @@ struct header_spec { static void header_spec_free(struct header_spec *s) { + if (!s) + return; + free(s->name); + s->name = NULL; + free(s->struct_type_name); + s->struct_type_name = NULL; } static int @@ -297,7 +311,11 @@ struct metadata_spec { static void metadata_spec_free(struct metadata_spec *s) { + if (!s) + return; + free(s->struct_type_name); + s->struct_type_name = NULL; } static int