gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r23577 - Extractor/src/main
Date: Mon, 3 Sep 2012 15:40:54 +0200

Author: grothoff
Date: 2012-09-03 15:40:54 +0200 (Mon, 03 Sep 2012)
New Revision: 23577

Modified:
   Extractor/src/main/extractor_plugpath.c
Log:
fix use after free

Modified: Extractor/src/main/extractor_plugpath.c
===================================================================
--- Extractor/src/main/extractor_plugpath.c     2012-09-03 13:40:44 UTC (rev 
23576)
+++ Extractor/src/main/extractor_plugpath.c     2012-09-03 13:40:54 UTC (rev 
23577)
@@ -305,7 +305,7 @@
       LOG_STRERROR ("strdup");
       return NULL;
     }
-  if (NULL == (buf = malloc (strlen(path) + 20)))
+  if (NULL == (buf = malloc (strlen (path) + 20)))
     {
       LOG_STRERROR ("malloc");
       free (path);
@@ -315,18 +315,19 @@
   while (NULL != (end = strchr(pos, ':'))) 
     {
       *end = '\0';
-      sprintf(buf, "%s/%s", pos, "extract");
+      sprintf (buf, "%s/%s", pos, "extract");
       if (0 == stat(buf, &sbuf)) 
        {
          free (buf);
-         free (path);
-         if (NULL == (pos = strdup(pos)))
+         if (NULL == (pos = strdup (pos)))
            {
              LOG_STRERROR ("strdup");
+             free (path);
              return NULL;
            }
+         free (path);
          pos = cut_bin (pos);
-         if (NULL == (ret = realloc (pos, strlen(pos) + 5)))
+         if (NULL == (ret = realloc (pos, strlen (pos) + 5)))
            {
              LOG_STRERROR ("realloc");
              free (pos);
@@ -337,7 +338,7 @@
        }
       pos = end + 1;
     }
-  sprintf(buf, "%s/%s", pos, "extract");
+  sprintf (buf, "%s/%s", pos, "extract");
   if (0 == stat (buf, &sbuf)) 
     {
       pos = strdup (pos);
@@ -346,7 +347,7 @@
       if (NULL == pos)
        return NULL;
       pos = cut_bin (pos);
-      if (NULL == (ret = realloc (pos, strlen(pos) + 5)))
+      if (NULL == (ret = realloc (pos, strlen (pos) + 5)))
        {
          LOG_STRERROR ("realloc");
          free (pos);
@@ -355,8 +356,8 @@
       strcat (ret, "lib/");
       return ret;
     }
-  free(buf);
-  free(path);
+  free (buf);
+  free (path);
   return NULL;
 }
 




reply via email to

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