source/rpc_parse/parse_prs.c ZERO_STRUCTP(ps) not needed as it is done
authorHerb Lewis <herb@samba.org>
Wed, 14 Jan 2004 22:53:50 +0000 (22:53 +0000)
committerHerb Lewis <herb@samba.org>
Wed, 14 Jan 2004 22:53:50 +0000 (22:53 +0000)
in prs_init now

testsuite/printing/psec.c cannot do a prs_mem_free() when tdb_prs_fetch fails
as the prs structure has not been initialized
(This used to be commit a363e5d8c549861329506bd87c11d82ace5520e5)

source3/rpc_parse/parse_prs.c
testsuite/printing/psec.c

index 58652fa0c5658a773c7c8f9bcaa70f0b92459161..0e5a25fe8c2894607927340ab4cb9066c446fa40 100644 (file)
@@ -1307,7 +1307,6 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me
     if (!dbuf.dptr)
            return -1;
 
-    ZERO_STRUCTP(ps);
     prs_init(ps, 0, mem_ctx, UNMARSHALL);
     prs_give_memory(ps, dbuf.dptr, dbuf.dsize, True);
 
index 9d38b9b10aed60273077bc460d2bfb1cbba5bc66..7ba40b18a3189948d490f3b84705d15754a07f5c 100644 (file)
@@ -195,8 +195,11 @@ int psec_getsec(char *printer)
        if (tdb_prs_fetch(tdb, keystr, &ps, mem_ctx) != 0) {
                printf("error fetching descriptor for printer %s\n",
                       printer);
-               result = 1;
-               goto done;
+               /* cannot do a prs_mem_free() when tdb_prs_fetch fails */
+               /* as the prs structure has not been initialized */
+               tdb_close(tdb);
+               talloc_destroy(mem_ctx);
+               return 1;
        }
 
        /* Unpack into security descriptor buffer */