tdb_open_ex should always "goto fail" in case of error, rather than
authorMartin Pool <mbp@samba.org>
Mon, 10 Dec 2001 05:12:52 +0000 (05:12 +0000)
committerMartin Pool <mbp@samba.org>
Mon, 10 Dec 2001 05:12:52 +0000 (05:12 +0000)
just returning.  I don't think this would leak at the moment, but it's
an accident waiting to happen.

source/tdb/tdb.c

index 955c0b322dfc0957874e6dab5933960ba642478a..3b0946d58041bd0b349482bcfeb598c73342df8f 100644 (file)
@@ -1463,11 +1463,12 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags,
                goto fail;
 
        /* Is it already in the open list?  If so, fail. */
+       if (tdb_already_open(st.st_dev, st.st_ino)
        for (i = tdbs; i; i = i->next) {
                if (i->device == st.st_dev && i->inode == st.st_ino) {
                        errno = EBUSY;
                        close(tdb->fd);
-                       return NULL;
+                       goto fail;
                }
        }