gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r11690 - in Extractor/src: main plugins


From: gnunet
Subject: [GNUnet-SVN] r11690 - in Extractor/src: main plugins
Date: Sat, 12 Jun 2010 17:09:44 +0200

Author: grothoff
Date: 2010-06-12 17:09:44 +0200 (Sat, 12 Jun 2010)
New Revision: 11690

Modified:
   Extractor/src/main/extractor.c
   Extractor/src/plugins/flv_extractor.c
Log:
fixes

Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c      2010-06-12 14:43:54 UTC (rev 11689)
+++ Extractor/src/main/extractor.c      2010-06-12 15:09:44 UTC (rev 11690)
@@ -175,6 +175,7 @@
   char line[1024];
   char dir[1024];
   char * lnk;
+  char * lestr;
   size_t size;
   FILE * f;
 
@@ -188,9 +189,9 @@
       if ( (1 == sscanf(line,
                        "%*x-%*x %*c%*c%*c%*c %*x %*2x:%*2x %*u%*[ ]%s",
                        dir)) &&
-          (NULL != strstr(dir,
-                          "libextractor")) ) {
-       strstr(dir, "libextractor")[0] = '\0';
+          (NULL != (lestr = strstr(dir,
+                                   "libextractor")) ) ) {
+       lestr[0] = '\0';
        fclose(f);
        return strdup(dir);
       }
@@ -202,6 +203,8 @@
           "/proc/%u/exe",
           getpid());
   lnk = malloc(1029); /* 1024 + 5 for "lib/" catenation */
+  if (lnk == NULL)         
+    return NULL;
   size = readlink(fn, lnk, 1023);
   if ( (size == 0) || (size >= 1024) ) {
     free(lnk);
@@ -220,6 +223,8 @@
   lnk[size] = '\0';
   lnk = cut_bin(lnk);
   lnk = realloc(lnk, strlen(lnk) + 5);
+  if (lnk == NULL)
+    return NULL;
   strcat(lnk, "lib/"); /* guess "lib/" as the library dir */
   return lnk;
 }
@@ -262,6 +267,8 @@
       path = _dyld_get_image_name(i);
       if (path != NULL && strlen(path) > 0) {
         p = strdup(path);
+       if (p == NULL)
+         return NULL;
         s = p + strlen(p);
         while ( (s > p) && (*s != '/') )
           s--;
@@ -293,7 +300,14 @@
   if (p == NULL)
     return NULL;
   path = strdup(p); /* because we write on it */
+  if (path == NULL)
+    return NULL;
   buf = malloc(strlen(path) + 20);
+  if (buf == NULL)
+    {
+      free (path);
+      return NULL;
+    }
   size = strlen(path);
   pos = path;
 
@@ -306,6 +320,8 @@
       free(path);
       pos = cut_bin(pos);
       pos = realloc(pos, strlen(pos) + 5);
+      if (pos == NULL)
+       return NULL;
       strcat(pos, "lib/");
       return pos;
     }
@@ -318,6 +334,8 @@
     free(path);
     pos = cut_bin(pos);
     pos = realloc(pos, strlen(pos) + 5);
+    if (pos == NULL)
+      return NULL;
     strcat(pos, "lib/");
     return pos;
   }
@@ -353,7 +371,8 @@
   if (fname[0] == DIR_SEPARATOR)
     fname++;
   ret = malloc (strlen (path) + strlen(fname) + 2);
-
+  if (ret == NULL)
+    return NULL;
 #ifdef MINGW
   if (path[strlen(path)-1] == '\\')
     sprintf (ret,
@@ -402,6 +421,8 @@
   if (p != NULL)
     {
       d = strdup (p);
+      if (d == NULL)
+       return;
       prefix = strtok (d, ":");
       while (NULL != prefix)
        {
@@ -429,10 +450,13 @@
   if (prefix == NULL)
     return;
   path = append_to_dir (prefix, PLUGINDIR);
-  if (0 != strcmp (path,
-                  PLUGININSTDIR))
-    pp (pp_cls, path);
-  free (path);
+  if (path != NULL)
+    {
+      if (0 != strcmp (path,
+                      PLUGININSTDIR))
+       pp (pp_cls, path);
+      free (path);
+    }
   free (prefix);
 }
 

Modified: Extractor/src/plugins/flv_extractor.c
===================================================================
--- Extractor/src/plugins/flv_extractor.c       2010-06-12 14:43:54 UTC (rev 
11689)
+++ Extractor/src/plugins/flv_extractor.c       2010-06-12 15:09:44 UTC (rev 
11690)
@@ -784,8 +784,6 @@
       case ASTYPE_STRING:
       {
         s = (char *)value;
-       if (s != NULL)
-         s = strdup(s);
         break;
       }
       case ASTYPE_DATE:




reply via email to

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