r14184: Coverity fix #56. Ensure we can't deref null.
[tprouty/samba.git] / source / printing / printing_db.c
index d45ad1cff796c02820158945f733bd6c0f9a811c..adea10dfa691b5277152a65f1e63ad1f5a5e3677 100644 (file)
@@ -80,7 +80,7 @@ struct tdb_print_db *get_print_db_byname(const char *printername)
        
        if (!p) {
                /* Create one. */
-               p = (struct tdb_print_db *)malloc(sizeof(struct tdb_print_db));
+               p = SMB_MALLOC_P(struct tdb_print_db);
                if (!p) {
                        DEBUG(0,("get_print_db: malloc fail !\n"));
                        return NULL;
@@ -188,7 +188,7 @@ TDB_DATA get_printer_notify_pid_list(TDB_CONTEXT *tdb, const char *printer_name,
 
                /* Entry is dead if process doesn't exist or refcount is zero. */
 
-               while ((i < data.dsize) && ((IVAL(data.dptr, i + 4) == 0) || !process_exists(pid))) {
+               while ((i < data.dsize) && ((IVAL(data.dptr, i + 4) == 0) || !process_exists_by_pid(pid))) {
 
                        /* Refcount == zero is a logic error and should never happen. */
                        if (IVAL(data.dptr, i + 4) == 0) {