diff options
author | Gaurav <g.gupta@samsung.com> | 2014-05-09 17:00:08 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2014-05-09 17:00:08 +0800 |
commit | 7966a761b77d24a70e8b81057c48319e32fbcc29 (patch) | |
tree | 91ce3e097626c341b4a30c8e2432e712ad6fb4ed /xmlmemory.c | |
parent | 41b0d1c4e53dcec2a0206df4bedaad0f81234319 (diff) | |
download | libxml2-7966a761b77d24a70e8b81057c48319e32fbcc29.tar.gz |
Avoid Possible null pointer dereference in memory debug mode
Fix a use before check on pointer
For https://bugzilla.gnome.org/show_bug.cgi?id=729849
Diffstat (limited to 'xmlmemory.c')
-rw-r--r-- | xmlmemory.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/xmlmemory.c b/xmlmemory.c index 25d93185..37dcf3b4 100644 --- a/xmlmemory.c +++ b/xmlmemory.c @@ -583,13 +583,15 @@ xmlMemBlocks(void) { static void xmlMemContentShow(FILE *fp, MEMHDR *p) { - int i,j,k,len = p->mh_size; - const char *buf = (const char *) HDR_2_CLIENT(p); + int i,j,k,len; + const char *buf; if (p == NULL) { fprintf(fp, " NULL"); return; } + len = p->mh_size; + buf = (const char *) HDR_2_CLIENT(p); for (i = 0;i < len;i++) { if (buf[i] == 0) break; |