Fix for bug 112784. The linked string array got broken which cause us to leak a bunch of strings. R=varada, SR=mscott

This commit is contained in:
ducarroz%netscape.com 2001-12-11 03:35:20 +00:00
parent 458adf0b19
commit f70cf8613d
3 changed files with 1845 additions and 1860 deletions

View File

@ -590,6 +590,7 @@ static int OutputBasicVcard(MimeObject *obj, VObject *v)
}
}
PR_FREEIF (namestring);
if (!htmlLine1 && !htmlLine2)
{
PR_FREEIF (htmlLine1);
@ -604,7 +605,6 @@ static int OutputBasicVcard(MimeObject *obj, VObject *v)
PR_FREEIF (htmlLine1);
PR_FREEIF (htmlLine2);
PR_FREEIF (namestring);
}
}
}
@ -1442,12 +1442,14 @@ static int WriteOutEachVCardPhoneProperty (MimeObject *obj, VObject* o)
{
status = OutputFont(obj, PR_FALSE, "-1", NULL);
if (status < 0) {
PR_FREEIF (value);
PR_FREEIF (attribName);
return status;
}
// write a label without charset conversion
status = WriteLineToStream (obj, attribName, PR_FALSE);
if (status < 0) {
PR_FREEIF (value);
PR_FREEIF (attribName);
return status;
}
@ -1455,10 +1457,12 @@ static int WriteOutEachVCardPhoneProperty (MimeObject *obj, VObject* o)
status = WriteLineToStream (obj, value, PR_TRUE);
if (status < 0) {
PR_FREEIF (value);
PR_FREEIF (attribName);
return status;
}
status = OutputFont(obj, PR_TRUE, NULL, NULL);
if (status < 0) {
PR_FREEIF (value);
PR_FREEIF (attribName);
return status;
}

View File

@ -152,7 +152,7 @@ VObject* newVObject(const char *id)
void deleteVObject(VObject *p)
{
unUseStr(p->id);
PR_FREEIF (p);
delete (p);
}
char* dupStr(const char *s, unsigned int size)
@ -731,7 +731,7 @@ void unUseStr(const char *s)
if (PL_strcasecmp(t->s,s) == 0) {
t->refCnt--;
if (t->refCnt == 0) {
if (p == strTbl[h]) {
if (t == strTbl[h]) {
strTbl[h] = t->next;
}
else {
@ -748,23 +748,6 @@ void unUseStr(const char *s)
}
}
void cleanStrTbl()
{
int i;
for (i=0; i<STRTBLSIZE;i++) {
StrItem *t = strTbl[i];
while (t) {
StrItem *p;
deleteString((char *)t->s);
p = t;
t = t->next;
deleteStrItem(p);
} while (t) {}
strTbl[i] = 0;
}
}
struct PreDefProp {
const char *name;
const char *alias;

View File

@ -418,8 +418,6 @@ extern "C" char* writeMemoryVObjects(char *s, int *len, VObject *list, PRBool ex
const char* lookupStr(const char *s);
void cleanStrTbl();
void cleanVObject(VObject *o);
void cleanVObjects(VObject *list);