gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r11693 - Extractor/src/main


From: gnunet
Subject: [GNUnet-SVN] r11693 - Extractor/src/main
Date: Sat, 12 Jun 2010 18:07:21 +0200

Author: grothoff
Date: 2010-06-12 18:07:21 +0200 (Sat, 12 Jun 2010)
New Revision: 11693

Modified:
   Extractor/src/main/extractor.c
Log:
check for NULL returned by allocators

Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c      2010-06-12 15:29:02 UTC (rev 11692)
+++ Extractor/src/main/extractor.c      2010-06-12 16:07:21 UTC (rev 11693)
@@ -318,6 +318,8 @@
       pos = strdup(pos);
       free(buf);
       free(path);
+      if (pos == NULL)
+       return NULL;
       pos = cut_bin(pos);
       pos = realloc(pos, strlen(pos) + 5);
       if (pos == NULL)
@@ -332,6 +334,8 @@
     pos = strdup(pos);
     free(buf);
     free(path);
+    if (pos == NULL)
+      return NULL;
     pos = cut_bin(pos);
     pos = realloc(pos, strlen(pos) + 5);
     if (pos == NULL)
@@ -503,6 +507,11 @@
        continue;       
       sym_name++;
       sym = strdup (sym_name);
+      if (sym == NULL)
+       {
+         closedir (dir);
+         return;
+       }
       dot = strstr (sym, ".");
       if (dot != NULL)
        *dot = '\0';
@@ -587,6 +596,11 @@
        continue;
       sym_name++;
       sym = strdup (sym_name);
+      if (NULL == sym)
+       {
+         closedir (dir);
+         return;
+       }
       dot = strstr (sym, ".");
       if (dot != NULL)
        *dot = '\0';
@@ -660,10 +674,17 @@
     return NULL;
   sym_name++;
   sym = strdup (sym_name);
+  if (sym == NULL)
+    return NULL;
   dot = strstr (sym, ".");
   if (dot != NULL)
     *dot = '\0';
   name = malloc(strlen(sym) + strlen(template) + 1);
+  if (name == NULL)
+    {
+      free (sym);
+      return NULL;
+    }
   sprintf(name,
          template,
          sym);
@@ -685,10 +706,11 @@
                  "`%s' and `%s'.\n",
                  name+1,
                  name,
-                 first_error,
+                 first_error == NULL ? "out of memory" : first_error,
                  lt_dlerror());
        }
-      free(first_error);
+      if (first_error != NULL)
+       free(first_error);
 #endif
     }
 
@@ -807,6 +829,11 @@
   result = calloc (1, sizeof (struct EXTRACTOR_PluginList));
   result->next = prev;
   result->short_libname = strdup (library);
+  if (result->short_libname == NULL)
+    {
+      free (result);
+      return NULL;
+    }
   result->libname = libname;
   result->flags = flags;
   if (NULL != options)
@@ -847,6 +874,8 @@
     return prev;
   len = strlen(config);
   cpy = strdup(config);
+  if (cpy == NULL)
+    return prev;
   pos = 0;
   last = 0;
   lastconf = 0;




reply via email to

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