]> git.proxmox.com Git - librados2-perl.git/commitdiff
mon command: fix calling free() code style-mix
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 21 Feb 2022 15:14:41 +0000 (16:14 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 21 Feb 2022 15:24:12 +0000 (16:24 +0100)
the error case checked for nullness on outbuf but not outs, while the
normal code path did the exact reverse, which is rather confusing for
any reader, as they could think there's something implied by this.

There isn't and rados' rados_buffer_free is already having its own
non-null check, not that it would matter much to call free with null
anyway.., but always using the rados provided method ensures tracing
shows the free, which could be good on debugging..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
RADOS.xs

index 1eb0b5a071b895b2f66e9492335236d4e9020dfc..a9df435807c1f73ad08eb1c9167a026ecab08a1e 100644 (file)
--- a/RADOS.xs
+++ b/RADOS.xs
@@ -136,19 +136,14 @@ CODE:
         }
         snprintf(msg, sizeof(msg), "mon_command failed - %.*s\n", (int)outslen, outs);
         rados_buffer_free(outs);
-        if (outbuf != NULL) {
-            rados_buffer_free(outbuf);
-        }
+        rados_buffer_free(outbuf);
         die(msg);
     }
 
     RETVAL = newSVpv(outbuf, outbuflen);
 
     rados_buffer_free(outbuf);
-
-    if (outs != NULL) {
-       rados_buffer_free(outs);
-    }
+    rados_buffer_free(outs);
 }
 OUTPUT: RETVAL