From: Kern Sibbald Date: Sat, 17 Nov 2012 08:11:32 +0000 (+0100) Subject: Avoid seg fault by checking for NULL client -- reported by Arno X-Git-Tag: Release-7.0.0~75 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=52936dff4071022a978f6ae5a36ba0270c2105e7;p=bacula%2Fbacula Avoid seg fault by checking for NULL client -- reported by Arno --- diff --git a/bacula/src/dird/ua_prune.c b/bacula/src/dird/ua_prune.c index a993edba6d..68c747cfce 100644 --- a/bacula/src/dird/ua_prune.c +++ b/bacula/src/dird/ua_prune.c @@ -129,7 +129,9 @@ int prunecmd(UAContext *ua, const char *cmd) switch (kw) { case 0: /* prune files */ - client = get_client_resource(ua); + if (!(client = get_client_resource(ua))) { + return false; + } if (find_arg_with_value(ua, "pool") >= 0) { pool = get_pool_resource(ua); } else { @@ -140,13 +142,15 @@ int prunecmd(UAContext *ua, const char *cmd) if (!confirm_retention(ua, &pool->FileRetention, "File")) { return false; } - } else if (!client || !confirm_retention(ua, &client->FileRetention, "File")) { + } else if (!confirm_retention(ua, &client->FileRetention, "File")) { return false; } prune_files(ua, client, pool); return true; case 1: /* prune jobs */ - client = get_client_resource(ua); + if (!(client = get_client_resource(ua))) { + return false; + } if (find_arg_with_value(ua, "pool") >= 0) { pool = get_pool_resource(ua); } else { @@ -157,7 +161,7 @@ int prunecmd(UAContext *ua, const char *cmd) if (!confirm_retention(ua, &pool->JobRetention, "Job")) { return false; } - } else if (!client || !confirm_retention(ua, &client->JobRetention, "Job")) { + } else if (!confirm_retention(ua, &client->JobRetention, "Job")) { return false; } /* ****FIXME**** allow user to select JobType */