[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: pcb.git: branch: master updated (38ac0fe9b2b4f758cbc2e67488c041706a034559)



The branch, master has been updated
       via  38ac0fe9b2b4f758cbc2e67488c041706a034559 (commit)
       via  afb76d4c4a55fa83f5661c8397470e58a35c6b33 (commit)
       via  ad2c809a6476d1a9eda5e510be7930bcc310fbdc (commit)
       via  792f285d070e235489623c84727bb39eb1dd0c9b (commit)
       via  ae80bb7bce8bb8368fac64c19dc971830624fb85 (commit)
       via  31c4de6fa2eec47d99ceb6d58381c98a837379d2 (commit)
       via  2550c8f20fc8f8e8652a793df2e4925989485f65 (commit)
       via  a209f78ca5df0fe107e774537025a77ceb0c1701 (commit)
       via  7303e24d34417c9502d6c1730e59f25cd6a12c78 (commit)
      from  8d112eee91986eecffc882ff2116dd281e476e68 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/file.c                        |   15 ++++++++-------
 src/hid/common/hidinit.c          |    1 +
 src/hid/common/hidnogui.c         |    4 ++--
 src/hid/gcode/gcode.c             |    4 +++-
 src/hid/gtk/ghid-layer-selector.c |    2 +-
 src/hid/gtk/gtkhid-main.c         |    1 +
 src/hid/lpr/lpr.c                 |    2 +-
 7 files changed, 17 insertions(+), 12 deletions(-)


=================
 Commit Messages
=================

commit 38ac0fe9b2b4f758cbc2e67488c041706a034559
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk/ghid_layer_selector.c: Use g_malloc for the new_layer structure
    
    This eventually gets free'd with g_free(). We need match these allocations
    and de-allocations carefully, otherwise various corruption and crashes
    could occur.
    
    (Caught with cppcheck)

:100644 100644 432e57e... 2b04063... M	src/hid/gtk/ghid-layer-selector.c

commit afb76d4c4a55fa83f5661c8397470e58a35c6b33
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/common/hidnogui.c: Plug leak in nogui_prompt_for and nogui_fileselect
    
    We forgot to free() the memory returned from read_stdin_line(). There is
    actually no need to strdup the answer anyway, so pass the returned value
    directly and let the caller free it.
    
    (Caught with cppcheck)

:100644 100644 9d88086... b08d90d... M	src/hid/common/hidnogui.c

commit ad2c809a6476d1a9eda5e510be7930bcc310fbdc
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/common: Don't leak the dir resource in hid_load_dir()
    
    Add missing closedir() call.
    
    (Caught with cppcheck)

:100644 100644 0bdd395... 3695f7d... M	src/hid/common/hidinit.c

commit 792f285d070e235489623c84727bb39eb1dd0c9b
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    file.c: Cleanup mixed pclose() / fclose() in ReadNetlist()
    
    In the "Empty netlist file!" error path, we called pclose()
    unconditionally where we should have tested "used_popen" first.
    
    (Caught with cppcheck)

:100644 100644 29358d6... 92e719b... M	src/file.c

commit ae80bb7bce8bb8368fac64c19dc971830624fb85
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    file.c: Plug leak of libpaths variable in ParseLibraryTree() function
    
    (Caught with cppcheck)

:100644 100644 501b735... 29358d6... M	src/file.c

commit 31c4de6fa2eec47d99ceb6d58381c98a837379d2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk: Free share_dir variable after use
    
    (Caught with cppcheck)

:100644 100644 544b6a2... cc474cd... M	src/hid/gtk/gtkhid-main.c

commit 2550c8f20fc8f8e8652a793df2e4925989485f65
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gcode: Fix memory leak in error path
    
    (Caught with cppcheck)

:100644 100644 40a3b36... 17bbae1... M	src/hid/gcode/gcode.c

commit a209f78ca5df0fe107e774537025a77ceb0c1701
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gcode: Fix mismatched g_strdup_printf() and free()
    
    Allocations from the g_*() functions shuold be free'd with g_free().
    
    (Caught with cppcheck)

:100644 100644 f12f6b6... 40a3b36... M	src/hid/gcode/gcode.c

commit 7303e24d34417c9502d6c1730e59f25cd6a12c78
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/lpr: Don't mis-match popen and fclose (should be pclose)
    
    (Caught with cppcheck)

:100644 100644 259812c... fc9403b... M	src/hid/lpr/lpr.c

=========
 Changes
=========

commit 38ac0fe9b2b4f758cbc2e67488c041706a034559
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk/ghid_layer_selector.c: Use g_malloc for the new_layer structure
    
    This eventually gets free'd with g_free(). We need match these allocations
    and de-allocations carefully, otherwise various corruption and crashes
    could occur.
    
    (Caught with cppcheck)

diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index 432e57e..2b04063 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -643,7 +643,7 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
       free_ldata (ls, new_layer);
     }
 
-  new_layer = malloc (sizeof (*new_layer));
+  new_layer = g_malloc (sizeof (*new_layer));
 
   gtk_list_store_set (ls->list_store,
                       &iter,

commit afb76d4c4a55fa83f5661c8397470e58a35c6b33
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/common/hidnogui.c: Plug leak in nogui_prompt_for and nogui_fileselect
    
    We forgot to free() the memory returned from read_stdin_line(). There is
    actually no need to strdup the answer anyway, so pass the returned value
    directly and let the caller free it.
    
    (Caught with cppcheck)

diff --git a/src/hid/common/hidnogui.c b/src/hid/common/hidnogui.c
index 9d88086..b08d90d 100644
--- a/src/hid/common/hidnogui.c
+++ b/src/hid/common/hidnogui.c
@@ -381,7 +381,7 @@ nogui_prompt_for (const char *msg, const char *default_string)
   if (answer == NULL)
     return strdup ((default_string != NULL) ? default_string : "");
   else
-    return strdup (answer);
+    return answer;
 }
 
 /* FIXME - this could use some enhancement to actually use the other
@@ -402,7 +402,7 @@ nogui_fileselect (const char *title, const char *descr,
   if (answer == NULL)
     return (default_file != NULL) ? strdup (default_file) : NULL;
   else
-    return strdup (answer);
+    return answer;
 }
 
 static int

commit ad2c809a6476d1a9eda5e510be7930bcc310fbdc
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/common: Don't leak the dir resource in hid_load_dir()
    
    Add missing closedir() call.
    
    (Caught with cppcheck)

diff --git a/src/hid/common/hidinit.c b/src/hid/common/hidinit.c
index 0bdd395..3695f7d 100644
--- a/src/hid/common/hidinit.c
+++ b/src/hid/common/hidinit.c
@@ -117,6 +117,7 @@ hid_load_dir (char *dirname)
       free (path);
     }
   free (dirname);
+  closedir (dir);
 }
 
 void

commit 792f285d070e235489623c84727bb39eb1dd0c9b
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    file.c: Cleanup mixed pclose() / fclose() in ReadNetlist()
    
    In the "Empty netlist file!" error path, we called pclose()
    unconditionally where we should have tested "used_popen" first.
    
    (Caught with cppcheck)

diff --git a/src/file.c b/src/file.c
index 29358d6..92e719b 100644
--- a/src/file.c
+++ b/src/file.c
@@ -1536,10 +1536,11 @@ ReadNetlist (char *filename)
   LibraryEntryTypePtr entry;
   int i, j, lines, kind;
   bool continued;
-  int used_popen = 0;
+  bool used_popen = false;
+  int retval = 0;
 
   if (!filename)
-    return (1);			/* nothing to do */
+    return 1;			/* nothing to do */
 
   Message (_("Importing PCB netlist %s\n"), filename);
 
@@ -1554,7 +1555,7 @@ ReadNetlist (char *filename)
     }
   else
     {
-      used_popen = 1;
+      used_popen = true;
       free (command);
       command = EvaluateFilename (Settings.RatCommand,
 				  Settings.RatPath, filename, NULL);
@@ -1563,7 +1564,7 @@ ReadNetlist (char *filename)
       if (*command == '\0' || (fp = popen (command, "r")) == NULL)
 	{
 	  PopenErrorMessage (command);
-	  return (1);
+	  return 1;
 	}
     }
   lines = 0;
@@ -1634,15 +1635,14 @@ ReadNetlist (char *filename)
   if (!lines)
     {
       Message (_("Empty netlist file!\n"));
-      pclose (fp);
-      return (1);
+      retval = 1;
     }
   if (used_popen)
     pclose (fp);
   else
     fclose (fp);
   sort_netlist ();
-  return (0);
+  return retval;
 }
 
 static int ReadEdifNetlist (char *filename);

commit ae80bb7bce8bb8368fac64c19dc971830624fb85
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    file.c: Plug leak of libpaths variable in ParseLibraryTree() function
    
    (Caught with cppcheck)

diff --git a/src/file.c b/src/file.c
index 501b735..29358d6 100644
--- a/src/file.c
+++ b/src/file.c
@@ -1402,6 +1402,7 @@ ParseLibraryTree (void)
   printf("Leaving ParseLibraryTree, found %d footprints.\n", n_footprints);
 #endif
 
+  free (libpaths);
   return n_footprints;
 }
 

commit 31c4de6fa2eec47d99ceb6d58381c98a837379d2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gtk: Free share_dir variable after use
    
    (Caught with cppcheck)

diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 544b6a2..cc474cd 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -2117,6 +2117,7 @@ hid_gtk_init ()
   free (tmps);
 #undef REST_OF_PATH
   printf ("\"Share\" installation path is \"%s\"\n", share_dir);
+  free (share_dir);
 #endif
 
   memset (&ghid_hid, 0, sizeof (HID));

commit 2550c8f20fc8f8e8652a793df2e4925989485f65
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gcode: Fix memory leak in error path
    
    (Caught with cppcheck)

diff --git a/src/hid/gcode/gcode.c b/src/hid/gcode/gcode.c
index 40a3b36..17bbae1 100644
--- a/src/hid/gcode/gcode.c
+++ b/src/hid/gcode/gcode.c
@@ -558,6 +558,8 @@ gcode_do_export (HID_Attr_Val * options)
           if (!gcode_f2)
             {
               perror (filename);
+              free (filename);
+              bm_free (bm);
               return;
             }
           fprintf (gcode_f2, "(Created by G-code exporter)\n");

commit a209f78ca5df0fe107e774537025a77ceb0c1701
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/gcode: Fix mismatched g_strdup_printf() and free()
    
    Allocations from the g_*() functions shuold be free'd with g_free().
    
    (Caught with cppcheck)

diff --git a/src/hid/gcode/gcode.c b/src/hid/gcode/gcode.c
index f12f6b6..40a3b36 100644
--- a/src/hid/gcode/gcode.c
+++ b/src/hid/gcode/gcode.c
@@ -388,7 +388,7 @@ gcode_start_png (const char *layername)
 
   gcode_alloc_colors ();
 
-  free (buf);
+  g_free (buf);
 }
 
 static void

commit 7303e24d34417c9502d6c1730e59f25cd6a12c78
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/lpr: Don't mis-match popen and fclose (should be pclose)
    
    (Caught with cppcheck)

diff --git a/src/hid/lpr/lpr.c b/src/hid/lpr/lpr.c
index 259812c..fc9403b 100644
--- a/src/hid/lpr/lpr.c
+++ b/src/hid/lpr/lpr.c
@@ -106,7 +106,7 @@ lpr_do_export (HID_Attr_Val * options)
 
   ps_hid_export_to_file (f, options);
 
-  fclose (f);
+  pclose (f);
 }
 
 static void




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs