Fix memory leaks
This commit is contained in:
@@ -1359,35 +1359,34 @@ _DtHelpCeGetSdlDocStamp(
|
|||||||
char **ret_time)
|
char **ret_time)
|
||||||
{
|
{
|
||||||
int result = -1;
|
int result = -1;
|
||||||
char *docId = NULL;
|
|
||||||
char *timestamp = NULL;
|
|
||||||
CESDLVolume *sdlVol = _DtHelpCeGetSdlVolumePtr(volume);
|
CESDLVolume *sdlVol = _DtHelpCeGetSdlVolumePtr(volume);
|
||||||
|
|
||||||
if (sdlVol->sdl_info != NULL)
|
if (sdlVol->sdl_info != NULL)
|
||||||
{
|
{
|
||||||
result = 0;
|
result = 0;
|
||||||
if (NULL != _SdlDocInfoPtrDocId(sdlVol->sdl_info))
|
char *tmp = _SdlDocInfoPtrDocId(sdlVol->sdl_info);
|
||||||
docId = strdup(_SdlDocInfoPtrDocId(sdlVol->sdl_info));
|
if (NULL != tmp) {
|
||||||
else
|
if (ret_doc != NULL) {
|
||||||
|
*ret_doc = strdup(tmp);
|
||||||
|
if (*ret_doc == NULL)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
result = -2;
|
result = -2;
|
||||||
|
}
|
||||||
|
|
||||||
if (NULL != _SdlDocInfoPtrStamp(sdlVol->sdl_info))
|
tmp = _SdlDocInfoPtrStamp(sdlVol->sdl_info);
|
||||||
timestamp = strdup(_SdlDocInfoPtrStamp(sdlVol->sdl_info));
|
if (NULL != tmp) {
|
||||||
else
|
if (ret_time != NULL) {
|
||||||
|
*ret_time = strdup(tmp);
|
||||||
|
if (*ret_time == NULL)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
result = -2;
|
result = -2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret_doc != NULL)
|
|
||||||
*ret_doc = docId;
|
|
||||||
if (ret_time != NULL)
|
|
||||||
*ret_time = timestamp;
|
|
||||||
|
|
||||||
if (result == 0 && (docId == NULL || timestamp == NULL)) {
|
|
||||||
free(docId); /* Incase only one of them is NULL */
|
|
||||||
free(timestamp); /* " */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ text_string = (char *)calloc (1, sizeof (char));
|
|||||||
if (xmstring) {
|
if (xmstring) {
|
||||||
if (!XmStringInitContext (&context, xmstring)) {
|
if (!XmStringInitContext (&context, xmstring)) {
|
||||||
printf("Can't convert compound string.\n");
|
printf("Can't convert compound string.\n");
|
||||||
|
free(text_string);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
while (XmStringGetNextSegment (context, &temp, &charset,
|
while (XmStringGetNextSegment (context, &temp, &charset,
|
||||||
|
|||||||
@@ -373,6 +373,7 @@ RoamMenuWindow::restoreSession(char *buf)
|
|||||||
{
|
{
|
||||||
fscanf(fp,"%s[\n]",buf);
|
fscanf(fp,"%s[\n]",buf);
|
||||||
LOG_CLOSEFILEPTR(log);
|
LOG_CLOSEFILEPTR(log);
|
||||||
|
delete [] workspaces;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,6 +473,7 @@ RoamMenuWindow::restoreSession(char *buf)
|
|||||||
rmw->manage();
|
rmw->manage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete [] workspaces;
|
||||||
LOG_CLOSEFILEPTR(log);
|
LOG_CLOSEFILEPTR(log);
|
||||||
return rmw;
|
return rmw;
|
||||||
}
|
}
|
||||||
@@ -594,6 +596,7 @@ SendMsgDialog::restoreSession(char *buf)
|
|||||||
{
|
{
|
||||||
fscanf(fp,"%s[\n]",buf);
|
fscanf(fp,"%s[\n]",buf);
|
||||||
LOG_CLOSEFILEPTR(log);
|
LOG_CLOSEFILEPTR(log);
|
||||||
|
delete [] workspaces;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,6 +674,7 @@ SendMsgDialog::restoreSession(char *buf)
|
|||||||
smd->manage();
|
smd->manage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete [] workspaces;
|
||||||
LOG_CLOSEFILEPTR(log);
|
LOG_CLOSEFILEPTR(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -313,6 +313,7 @@ DmxMsg::display (void)
|
|||||||
env.logError(DTM_FALSE, "DEBUG dtmailpr: v3_cs = %s\n", v3_cs);
|
env.logError(DTM_FALSE, "DEBUG dtmailpr: v3_cs = %s\n", v3_cs);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
delete [] v3_cs;
|
||||||
to_cs = firstPart->locToConvName();
|
to_cs = firstPart->locToConvName();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -358,16 +359,11 @@ DmxMsg::display (void)
|
|||||||
if (converted && contents)
|
if (converted && contents)
|
||||||
free(contents);
|
free(contents);
|
||||||
|
|
||||||
char *numbuf = new char [10241];
|
char *msgh = printHeader(MSGHEADER);
|
||||||
memset (numbuf, 0, 1024);
|
puts(msgh);
|
||||||
|
|
||||||
#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));
|
|
||||||
puts(buf);
|
puts(buf);
|
||||||
|
delete [] buf;
|
||||||
|
delete [] msgh;
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
@@ -418,12 +414,12 @@ DmxMsg::display (void)
|
|||||||
printf ("[%d] \"%s\"%s, ", i, name, description);
|
printf ("[%d] \"%s\"%s, ", i, name, description);
|
||||||
printf ("%s, %lu bytes\n", type, length);
|
printf ("%s, %lu bytes\n", type, length);
|
||||||
|
|
||||||
if (attbuf != NULL)
|
if (attbuf != NULL) {
|
||||||
delete [] attbuf;
|
delete [] attbuf;
|
||||||
|
attbuf = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] v3_cs;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user