1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

fixed #169630 segfault in xmlMemDisplay Daniel

* xmlmemory.c: fixed #169630 segfault in xmlMemDisplay
Daniel
This commit is contained in:
Daniel Veillard 2005-05-08 11:39:56 +00:00
parent 99dd7636a4
commit 942d6c7b4f
2 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,7 @@
Sun May 8 13:35:39 CEST 2005 Daniel Veillard <daniel@veillard.com>
* xmlmemory.c: fixed #169630 segfault in xmlMemDisplay
Fri May 6 13:40:03 CEST 2005 Daniel Veillard <daniel@veillard.com>
* nanoftp.c: fixing bug #303068 increasing the nanoftp buffer.

View File

@ -642,7 +642,18 @@ xmlMemDisplay(FILE *fp)
time_t currentTime;
char buf[500];
struct tm * tstruct;
#endif
#endif
FILE *old_fp = fp;
if (fp == NULL) {
fp = fopen(".memorylist", "w");
if (fp == NULL)
return;
}
#ifdef MEM_LIST
#if defined(HAVE_LOCALTIME) && defined(HAVE_STRFTIME)
currentTime = time(NULL);
tstruct = localtime(&currentTime);
strftime(buf, sizeof(buf) - 1, "%I:%M:%S %p", tstruct);
@ -668,6 +679,8 @@ xmlMemDisplay(FILE *fp)
default:
fprintf(fp,"Unknown memory block, may be corrupted");
xmlMutexUnlock(xmlMemMutex);
if (old_fp == NULL)
fclose(fp);
return;
}
if (p->mh_file != NULL) fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
@ -686,6 +699,8 @@ xmlMemDisplay(FILE *fp)
#else
fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
#endif
if (old_fp == NULL)
fclose(fp);
}
#ifdef MEM_LIST