[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kdepim-3.5.5+/kpilot/lib
From: Adriaan de Groot <groot () kde ! org>
Date: 2007-03-30 21:08:15
Message-ID: 1175288895.397256.31411.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 648267 by adridg:
SETUPL() never needs to go over 4, really; use len consistently; free memory \
allocated and not given away.
M +6 -4 branches/work/kdepim-3.5.5+/kpilot/lib/pilotMemo.cc
--- branches/work/kdepim-3.5.5+/kpilot/lib/pilotMemo.cc #648266:648267
@@ -43,17 +43,17 @@
PilotRecord *PilotMemo::pack()
{
- FUNCTIONSETUPL(20);
+ FUNCTIONSETUPL(4);
int i;
+ int len = fText.length() + 8;
struct Memo buf;
- buf.text = new char[fText.length() + 8];
- int len = fText.length() + 8;
+ buf.text = new char[len];
// put our text into buf
i = Pilot::toPilot(fText, buf.text, len);
- pi_buffer_t *b = pi_buffer_new(fText.length()+8);
+ pi_buffer_t *b = pi_buffer_new(len);
i = pack_Memo(&buf, b, memo_v1);
DEBUGKPILOT << fname << ": original text: [" << fText
@@ -63,11 +63,13 @@
if (i<0)
{
// Generic error from the pack_*() functions.
+ delete[] buf.text;
return 0;
}
// pack_Appointment sets b->used
PilotRecord *r = new PilotRecord(b, this);
+ delete[] buf.text;
return r;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic