commit ffd3097dd338fb6823b911a52e4e9f3656d5cd96
parent ae827dfa1091959ec4314afb0165b27ab567b8c5
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 21 Dec 2009 11:37:43 +0000
fixing CID 206
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/main/extractor.c b/src/main/extractor.c
@@ -1117,6 +1117,7 @@ process_requests (struct EXTRACTOR_PluginList *plugin,
{
if (strlen (fn) == 0)
break;
+ ptr = NULL;
fn[strlen(fn)-1] = '\0'; /* kill newline */
if ( (-1 != (shmid = shm_open (fn, O_RDONLY, 0))) &&
(((off_t)-1) != (size = lseek (shmid, 0, SEEK_END))) &&
@@ -1132,7 +1133,8 @@ process_requests (struct EXTRACTOR_PluginList *plugin,
if (0 != write_all (out, &hdr, sizeof(hdr)))
break;
}
- if (ptr != NULL)
+ if ( (ptr != NULL) &&
+ (ptr != (void*) -1) )
munmap (ptr, size);
if (-1 != shmid)
close (shmid);