Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1179719pxb; Thu, 4 Feb 2021 06:58:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyi9cpcCU3N+lMdq5cXqq6hrcvpvpdpnEIkHzgB98KC1neiQxzDd6sir+kUcsj6vK/Crzw8 X-Received: by 2002:a05:6402:4253:: with SMTP id g19mr7299825edb.343.1612450688238; Thu, 04 Feb 2021 06:58:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612450688; cv=none; d=google.com; s=arc-20160816; b=KDoG/chHcYI3kaW8TBPzR50Evi09KLvxtFeXdFy4vKaXchMwwmE3/jUzNfFbor1dK/ oFeWh6xe166PuatrDjSQ41vs3ZKaPZjimiAMYaBJ0mF5K6aLLpzHLl4qQh3yyoGnk81z fksUZbjNyhelBKco0e8GNxxzkx8RycbFhiAnrLH/xDiovNJBv5qT913HZUDOsZaHDQmY eeAQqAUJJqBDqGcV2YLliyDW1SD5DmIx/gDVeqqi8VllLaVoumGzJgG2KG0DQbKOliv3 KPW+z/wNn3mIvuFC/aWTCYFrowJWeioSBEFpGwSQ71sT68eXvPhO/ZH9+AV4No9eF8mk C61g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/bXhNm9KwpDexU8pLCeEwowBlnm7DpOxgyBpK3M5ji8=; b=oF2fOwdK5qS2xh1s1JqPqG48CQegkhIG+r1NQfbITX3cuxA+LAL+ViLKapJ1FZpUYO 4CuPyZxuDv/tZKiqWK6L5IZ/RdnP/z8YuTUWOUaOt10wo/8mDhxuv3Ai3MXUvp2DxtST q8t0UuyMPatyj6ALsYUwJRHz36XQF/s5vAM+HMrJs4WZLy8GfpxyY94lVIieq7d+Xc/i gV/KLjPtexNJBbroatUJcJGTa1VhVSz2ttSP3UXleDyJ4bsyrFDe1ebjbnNaMCFvC+To Qyemf+oyS+LRh3EnNJbV9mnEasfNgdLeLj5sWSHpk2ede3HuNbUkNvc/mNl2lxaQXGIO nZdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SH4u6COo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id uz29si3269341ejb.527.2021.02.04.06.57.42; Thu, 04 Feb 2021 06:58:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SH4u6COo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236958AbhBDOyq (ORCPT + 99 others); Thu, 4 Feb 2021 09:54:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59320 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236911AbhBDOwu (ORCPT ); Thu, 4 Feb 2021 09:52:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612450280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/bXhNm9KwpDexU8pLCeEwowBlnm7DpOxgyBpK3M5ji8=; b=SH4u6COoPv3dSo/wMMSxdRaYsiloerIxKVraJ5OxZXnqh7KaptsGsetkSGXARYUyxQqqgD dgI/CbKbGNPihVPdzlR9mG/XMvdEO4AMjZ0h00vY5kDXrpQ3UpAaHhSjKNJHw/c/1I5CD4 Nt+U+JRVaqYaacpwmCoXqkIGr3F5k6E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-470-EuZoKhJUOOKL2fX810sTFA-1; Thu, 04 Feb 2021 09:51:16 -0500 X-MC-Unique: EuZoKhJUOOKL2fX810sTFA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E92691935780; Thu, 4 Feb 2021 14:51:14 +0000 (UTC) Received: from krava (unknown [10.40.194.33]) by smtp.corp.redhat.com (Postfix) with SMTP id 89F6F60CFA; Thu, 4 Feb 2021 14:51:12 +0000 (UTC) Date: Thu, 4 Feb 2021 15:51:11 +0100 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Ian Rogers , Stephane Eranian , Alexei Budankov Subject: Re: [PATCH 07/24] perf daemon: Add config file change check Message-ID: References: <20210129134855.195810-1-jolsa@redhat.com> <20210130234856.271282-1-jolsa@kernel.org> <20210130234856.271282-8-jolsa@kernel.org> <20210203211359.GT854763@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210203211359.GT854763@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 03, 2021 at 06:13:59PM -0300, Arnaldo Carvalho de Melo wrote: SNIP > > #include > > #include > > #include > > @@ -73,6 +75,7 @@ struct session { > > struct daemon { > > const char *config; > > char *config_real; > > + char *config_base; > > const char *base_user; > > char *base; > > struct list_head sessions; > > @@ -493,6 +496,7 @@ static void daemon__free(struct daemon *daemon) > > session__remove(session); > > > > free(daemon->config_real); > > + free(daemon->config_base); > > free(daemon->base); > > Please replace those with zfree() ok > > > } > > > > @@ -535,6 +539,83 @@ static int daemon__reconfig(struct daemon *daemon) > > return 0; > > } > > > > +static int setup_config_changes(struct daemon *daemon) > > +{ > > + char *basen = strdup(daemon->config_real); > > + char *dirn = strdup(daemon->config_real); > > + char *base, *dir; > > + int fd, wd; > > + > > + if (!dirn || !basen) > > + return -ENOMEM; > > This may leak one of them right, will fix thanks, jirka