[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12539 - Extractor/src/plugins
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12539 - Extractor/src/plugins |
Date: |
Sat, 14 Aug 2010 22:35:34 +0200 |
Author: grothoff
Date: 2010-08-14 22:35:34 +0200 (Sat, 14 Aug 2010)
New Revision: 12539
Modified:
Extractor/src/plugins/id3v24_extractor.c
Extractor/src/plugins/odf_extractor.c
Log:
fix leak
Modified: Extractor/src/plugins/id3v24_extractor.c
===================================================================
--- Extractor/src/plugins/id3v24_extractor.c 2010-08-14 20:31:19 UTC (rev
12538)
+++ Extractor/src/plugins/id3v24_extractor.c 2010-08-14 20:35:34 UTC (rev
12539)
@@ -364,7 +364,11 @@
off++;
if ( (off >= csize) ||
(data[pos+off] != '\0') )
- return 0; /* malformed */
+ {
+ if (mime != NULL)
+ free (mime);
+ return 0; /* malformed */
+ }
off++;
if ( (mime != NULL) &&
(0 == strcasecmp ("-->",
Modified: Extractor/src/plugins/odf_extractor.c
===================================================================
--- Extractor/src/plugins/odf_extractor.c 2010-08-14 20:31:19 UTC (rev
12538)
+++ Extractor/src/plugins/odf_extractor.c 2010-08-14 20:35:34 UTC (rev
12539)
@@ -196,18 +196,20 @@
return 0; /* hardly meta-data! */
}
buf = malloc(buf_size+1);
- if (buf == NULL) {
- EXTRACTOR_common_unzip_close_current_file(uf);
- EXTRACTOR_common_unzip_close(uf);
- return 0; /* out of memory */
- }
+ if (buf == NULL)
+ {
+ EXTRACTOR_common_unzip_close_current_file(uf);
+ EXTRACTOR_common_unzip_close(uf);
+ return 0; /* out of memory */
+ }
- if (buf_size != EXTRACTOR_common_unzip_read_current_file(uf,buf,buf_size)) {
- free(buf);
- EXTRACTOR_common_unzip_close_current_file(uf);
- EXTRACTOR_common_unzip_close(uf);
- return 0;
- }
+ if (buf_size != EXTRACTOR_common_unzip_read_current_file(uf,buf,buf_size))
+ {
+ free(buf);
+ EXTRACTOR_common_unzip_close_current_file(uf);
+ EXTRACTOR_common_unzip_close(uf);
+ return 0;
+ }
EXTRACTOR_common_unzip_close_current_file(uf);
/* we don't do "proper" parsing of the meta-data but rather use some
heuristics
to get values out that we understand */
@@ -223,7 +225,6 @@
char * spos;
char * epos;
char needle[256];
- char * key;
int oc;
pbuf = buf;
@@ -263,24 +264,27 @@
epos++;
}
}
- if (spos != epos) {
- key = malloc(1+epos-spos);
- memcpy(key, spos, epos-spos);
- key[epos-spos] = '\0';
- if (0 != proc (proc_cls,
- "odf",
- tmap[i].type,
- EXTRACTOR_METAFORMAT_UTF8,
- "text/plain",
- key,
- strlen (key)+1))
- {
- free(buf);
- EXTRACTOR_common_unzip_close(uf);
- return 1;
- }
- pbuf = epos;
- } else
+ if (spos != epos)
+ {
+ char key[epos - spos + 1];
+
+ memcpy(key, spos, epos-spos);
+ key[epos-spos] = '\0';
+ if (0 != proc (proc_cls,
+ "odf",
+ tmap[i].type,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain",
+ key,
+ epos - spos + 1))
+ {
+ free(buf);
+ EXTRACTOR_common_unzip_close(uf);
+ return 1;
+ }
+ pbuf = epos;
+ }
+ else
break;
}
}
@@ -290,3 +294,4 @@
return 0;
}
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12539 - Extractor/src/plugins,
gnunet <=