]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/guid_to_name.c
Attempt to fix bat seg faults
[bacula/bacula] / bacula / src / lib / guid_to_name.c
index f5415f3f0209581ac51e266334234d129b527cd7..e407c2247d139b8f38c23d7fddfdb5f79dbd88ca 100644 (file)
@@ -20,7 +20,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
@@ -147,6 +147,7 @@ char *guid_list::uid_to_name(uid_t uid, char *name, int maxlen)
       }
       fitem = (guitem *)uid_list->binary_insert(item, uid_compare);
       if (fitem != item) {               /* item already there this shouldn't happen */
+         free(item->name);
          free(item);
          item = fitem;   
       }
@@ -161,7 +162,7 @@ char *guid_list::gid_to_name(gid_t gid, char *name, int maxlen)
    sitem.gid = gid;
    char buf[50];
 
-   item = (guitem *)uid_list->binary_search(&sitem, gid_compare);
+   item = (guitem *)gid_list->binary_search(&sitem, gid_compare);
    if (!item) {
       item = (guitem *)malloc(sizeof(guitem));
       item->gid = gid;
@@ -172,6 +173,7 @@ char *guid_list::gid_to_name(gid_t gid, char *name, int maxlen)
       }
       fitem = (guitem *)gid_list->binary_insert(item, gid_compare);
       if (fitem != item) {               /* item already there this shouldn't happen */
+         free(item->name);
          free(item);
          item = fitem;   
       }