]> granicus.if.org Git - graphviz/commitdiff
remove unnecessary not-null guards to free in Operator_diag_precon_delete
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 26 Jun 2021 23:19:44 +0000 (16:19 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 17 Jul 2021 17:45:45 +0000 (10:45 -0700)
It is well-defined to free null. Apart from this though, the first condition
containing a dereference of `o` implies that `o` is not null so the second
condition can be assumed true.

lib/sfdpgen/sparse_solve.c

index 49bcd21d48dabf2fb5ea9f7e7e0f3db25f40f828..e68e8db17c6109f428dbd314782f03c913a7a327 100644 (file)
@@ -147,8 +147,8 @@ static Operator Operator_diag_precon_new(SparseMatrix A){
 }
 
 static void Operator_diag_precon_delete(Operator o){
-  if (o->data) FREE(o->data);
-  if (o) FREE(o);
+  FREE(o->data);
+  FREE(o);
 }
 
 static real conjugate_gradient(Operator A, Operator precon, int n, real *x, real *rhs, real tol, int maxit){