From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 7062 invoked from network); 26 May 2020 22:16:47 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 26 May 2020 22:16:47 -0000 Received: (qmail 7478 invoked by alias); 26 May 2020 22:16:41 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45924 Received: (qmail 4584 invoked by uid 1010); 26 May 2020 22:16:41 -0000 X-Qmail-Scanner-Diagnostics: from wout4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25821. spamassassin: 3.4.4. Clear:RC:0(64.147.123.20):SA:0(-2.6/5.0):. Processed in 0.723174 secs); 26 May 2020 22:16:41 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddvfedgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtgfesth hqredtreerjeenucfhrhhomhepfdffrghnihgvlhcuufhhrghhrghffdcuoegurdhssegu rghnihgvlhdrshhhrghhrghfrdhnrghmvgeqnecuggftrfgrthhtvghrnhepfefhkeefve eileelheeiffdtkedujeelvdfhtdejtdeggedvuefffeelhefhvdfgnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghlrd hshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-dev0-488-g9249dd4-fm-20200522.001-g9249dd48 Mime-Version: 1.0 Message-Id: In-Reply-To: <20200526220638.26711-1-danielsh@tarpaulin.shahaf.local2> References: <20200526220638.26711-1-danielsh@tarpaulin.shahaf.local2> Date: Tue, 26 May 2020 22:15:46 +0000 From: "Daniel Shahaf" To: zsh-workers@zsh.org Subject: =?UTF-8?Q?Re:_[PATCH]_zprof:_Don't_tally_all_anonymous_functions_as_thou?= =?UTF-8?Q?gh_they_were_a_single_function_named_"(anon)".?= Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Daniel Shahaf wrote on Tue, 26 May 2020 22:06 +00:00: > +++ b/Src/Modules/zprof.c > @@ -213,7 +213,25 @@ bin_zprof(UNUSED(char *nam), UNUSED(char **args),= =20 > @@ -224,12 +242,19 @@ zprof_wrapper(Eprog prog, FuncWrap w, char *name= ) > + char *name_for_lookups; > + > + if (is_anonymous_function_name(name)) { > + name_for_lookups =3D name_for_anonymous_function(name); > + } else { > + name_for_lookups =3D ztrdup(name); Memory leak when either of the next two conditions is false. > + } > =20 > if (zprof_module && !(zprof_module->node.flags & MOD_UNLOAD)) { > active =3D 1; > - if (!(f =3D findpfunc(name))) { > + if (!(f =3D findpfunc(name_for_lookups))) { > f =3D (Pfunc) zalloc(sizeof(*f)); > - f->name =3D ztrdup(name); > + f->name =3D name_for_lookups; > f->calls =3D 0; > f->time =3D f->self =3D 0.0; > f->next =3D calls; > Should =C2=ABfuncstack=C2=BB be checked for NULL before it's dereferen= ced? =20 > The funcstack frame is added in doshfunc() while wrappers are called > from runshfunc(). I don't see any case in which doshfunc() won't have= > been called by the time runshfunc() has, but then I don't completely > grok the sense of the EF_RUN flag as used in doshfunc(). This question stands. Cheers, Daniel