Fix memory leaks

This commit is contained in:
Patrick Georgi
2025-12-14 11:54:14 +01:00
parent ae767ed3dc
commit b86eff35f0
4 changed files with 31 additions and 31 deletions

View File

@@ -95,6 +95,7 @@ text_string = (char *)calloc (1, sizeof (char));
if (xmstring) {
if (!XmStringInitContext (&context, xmstring)) {
printf("Can't convert compound string.\n");
free(text_string);
return (NULL);
}
while (XmStringGetNextSegment (context, &temp, &charset,

View File

@@ -373,6 +373,7 @@ RoamMenuWindow::restoreSession(char *buf)
{
fscanf(fp,"%s[\n]",buf);
LOG_CLOSEFILEPTR(log);
delete [] workspaces;
return NULL;
}
@@ -472,6 +473,7 @@ RoamMenuWindow::restoreSession(char *buf)
rmw->manage();
}
delete [] workspaces;
LOG_CLOSEFILEPTR(log);
return rmw;
}
@@ -594,6 +596,7 @@ SendMsgDialog::restoreSession(char *buf)
{
fscanf(fp,"%s[\n]",buf);
LOG_CLOSEFILEPTR(log);
delete [] workspaces;
return;
}
@@ -671,6 +674,7 @@ SendMsgDialog::restoreSession(char *buf)
smd->manage();
}
delete [] workspaces;
LOG_CLOSEFILEPTR(log);
}

View File

@@ -313,6 +313,7 @@ DmxMsg::display (void)
env.logError(DTM_FALSE, "DEBUG dtmailpr: v3_cs = %s\n", v3_cs);
#endif
}
delete [] v3_cs;
to_cs = firstPart->locToConvName();
#ifdef DEBUG
@@ -358,16 +359,11 @@ DmxMsg::display (void)
if (converted && contents)
free(contents);
char *numbuf = new char [10241];
memset (numbuf, 0, 1024);
#ifdef NEVER
// Don't want "Message 1:" appearing in print output
sprintf (numbuf, "Messsage %s:\n%s\n",
addlInfo, printHeader (MSGHEADER));
#endif
puts(printHeader(MSGHEADER));
char *msgh = printHeader(MSGHEADER);
puts(msgh);
puts(buf);
delete [] buf;
delete [] msgh;
fflush(stdout);
@@ -418,12 +414,12 @@ DmxMsg::display (void)
printf ("[%d] \"%s\"%s, ", i, name, description);
printf ("%s, %lu bytes\n", type, length);
if (attbuf != NULL)
if (attbuf != NULL) {
delete [] attbuf;
attbuf = NULL;
}
}
delete [] v3_cs;
return;
}