[haiku-bugs] Re: [Haiku] #11934: [PATCH] Solve memory leaks in Deskbar and some replicants.

  • From: "korli" <trac@xxxxxxxxxxxx>
  • Date: Thu, 02 Apr 2015 06:41:36 -0000

#11934: [PATCH] Solve memory leaks in Deskbar and some replicants.
------------------------------+----------------------------
Reporter: Barrett | Owner: stippi
Type: enhancement | Status: new
Priority: normal | Milestone: R1
Component: User Interface | Version: R1/Development
Resolution: | Keywords: Deskbar
Blocked By: | Blocking:
Has a Patch: 1 | Platform: All
------------------------------+----------------------------

Comment (by korli):

0001:

{{{
BStackOrHeapArray<char, 128> truncatedLabel(strlen(label) + 4);
}}}
truncatedLabel.IsValid() should be called to check that the allocation
succeeded. truncatedLabel != NULL should be replaced with
truncatedLabel.IsValid().

0002:
{{{
if (replicant.FindMessage("message", replMsg) == B_OK)
if (AddReplicant(replMsg, point) != B_OK)
delete replMsg;
}}}

When the first condition fails, replMsg is leaked.

--
Ticket URL: <https://dev.haiku-os.org/ticket/11934#comment:10>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: