From 43ab5a2c47f0a7cb1b09ffc23dc9e8b3c017afbc Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 21 Feb 2022 16:14:41 +0100 Subject: [PATCH] mon command: fix calling free() code style-mix 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 --- RADOS.xs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/RADOS.xs b/RADOS.xs index 1eb0b5a..a9df435 100644 --- 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 -- 2.39.2