[gimp/merge-requests/470: 1/5] libgimp: fix pspec leak when procedure argument has already been specified




commit a1f942ad400c0998abf42753d698c3b1ff99eb45
Author: Andrzej Hunt <andrzej ahunt org>
Date:   Fri Aug 27 17:54:33 2021 +0200

    libgimp: fix pspec leak when procedure argument has already been specified
    
    In the normal flow, pspec is persisted in the arguments array, and is
    g_param_spec_ref_sink()'d in order to sink a possible floating ref. To
    avoid a leak in the error case, we need to add some g_param_spec_sink().

 libgimp/gimpprocedure.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/libgimp/gimpprocedure.c b/libgimp/gimpprocedure.c
index e56e035a8c..81ec0c057d 100644
--- a/libgimp/gimpprocedure.c
+++ b/libgimp/gimpprocedure.c
@@ -1226,6 +1226,7 @@ gimp_procedure_add_argument (GimpProcedure *procedure,
       g_warning ("Argument with name '%s' already exists on procedure '%s'",
                  pspec->name,
                  gimp_procedure_get_name (procedure));
+      g_param_spec_sink (pspec);
       return pspec;
     }
 
@@ -1235,6 +1236,7 @@ gimp_procedure_add_argument (GimpProcedure *procedure,
                  "on procedure '%s'",
                  pspec->name,
                  gimp_procedure_get_name (procedure));
+      g_param_spec_sink (pspec);
       return pspec;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]