From: Eric Bollengier Date: Wed, 4 Dec 2024 08:06:22 +0000 (+0100) Subject: bpipe: Fix org#2737 About segfault with bpipe X-Git-Tag: Release-15.0.3~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=453dc8ef9e41ba21b7fc4b69ab49e5f31f40b067;p=thirdparty%2Fbacula.git bpipe: Fix org#2737 About segfault with bpipe p_ctx->cmd is allocated with strdup() and released with smartalloc and it causes the segfault. Thanks to Marcin for this report. --- diff --git a/bacula/src/plugins/fd/bpipe-fd.c b/bacula/src/plugins/fd/bpipe-fd.c index 665a23671..a1296fbd0 100644 --- a/bacula/src/plugins/fd/bpipe-fd.c +++ b/bacula/src/plugins/fd/bpipe-fd.c @@ -202,7 +202,9 @@ static bRC freePlugin(bpContext *ctx) if (!p_ctx) { return bRC_Error; } - bfree_and_null(p_ctx->cmd); + if (p_ctx->cmd) { + free(p_ctx->cmd); /* free any allocated command string */ + } free_and_null_pool_memory(p_ctx->restore_obj_buf); if (p_ctx->rop_writer) { restoreobj *rop;