gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r12536 - Extractor/src/plugins


From: gnunet
Subject: [GNUnet-SVN] r12536 - Extractor/src/plugins
Date: Sat, 14 Aug 2010 22:22:00 +0200

Author: grothoff
Date: 2010-08-14 22:22:00 +0200 (Sat, 14 Aug 2010)
New Revision: 12536

Modified:
   Extractor/src/plugins/dvi_extractor.c
Log:
avoid malloc and strlen

Modified: Extractor/src/plugins/dvi_extractor.c
===================================================================
--- Extractor/src/plugins/dvi_extractor.c       2010-08-14 20:20:57 UTC (rev 
12535)
+++ Extractor/src/plugins/dvi_extractor.c       2010-08-14 20:22:00 UTC (rev 
12536)
@@ -188,24 +188,20 @@
                 "application/x-dvi",
                 strlen ("application/x-dvi") +1))
     return 1;
-  comment = malloc (klen + 1);
-  if (comment != NULL)
-    {
-      comment[klen] = '\0';
-      memcpy (comment, &data[15], klen);
-      if (0 != proc (proc_cls, 
-                    "dvi",
-                    EXTRACTOR_METATYPE_COMMENT,
-                    EXTRACTOR_METAFORMAT_UTF8,
-                    "text/plain",
-                    comment,
-                    strlen (comment) +1))
-       {
-         free (comment);
-         return 1;
-       }
-      free (comment);
-    }
+  {
+    char comment[klen + 1];
+    
+    comment[klen] = '\0';
+    memcpy (comment, &data[15], klen);
+    if (0 != proc (proc_cls, 
+                  "dvi",
+                  EXTRACTOR_METATYPE_COMMENT,
+                  EXTRACTOR_METAFORMAT_UTF8,
+                  "text/plain",
+                  comment,
+                  klen +1))
+      return 1;
+  }
   /* try to find PDF/ps special */
   pos = opos;
   while (pos < size - 100)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]