1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

r9244: Fix bugs found by Coverity.

Jeremy.
This commit is contained in:
Jeremy Allison 2005-08-11 20:44:18 +00:00 committed by Gerald (Jerry) Carter
parent 4deb918b68
commit bf80edeea7

View File

@ -399,8 +399,10 @@ uint32 sysjob_to_jobid(int unix_jobid)
if (!lp_print_ok(snum)) if (!lp_print_ok(snum))
continue; continue;
pdb = get_print_db_byname(lp_const_servicename(snum)); pdb = get_print_db_byname(lp_const_servicename(snum));
if (pdb) if (!pdb) {
tdb_traverse(pdb->tdb, unixjob_traverse_fn, &unix_jobid); continue;
}
tdb_traverse(pdb->tdb, unixjob_traverse_fn, &unix_jobid);
release_print_db(pdb); release_print_db(pdb);
if (sysjob_to_jobid_value != (uint32)-1) if (sysjob_to_jobid_value != (uint32)-1)
return sysjob_to_jobid_value; return sysjob_to_jobid_value;
@ -1067,6 +1069,10 @@ static void print_queue_update_internal( const char *sharename,
TDB_DATA jcdata; TDB_DATA jcdata;
fstring keystr, cachestr; fstring keystr, cachestr;
struct tdb_print_db *pdb = get_print_db_byname(sharename); struct tdb_print_db *pdb = get_print_db_byname(sharename);
if (!pdb) {
return;
}
DEBUG(5,("print_queue_update_internal: printer = %s, type = %d, lpq command = [%s]\n", DEBUG(5,("print_queue_update_internal: printer = %s, type = %d, lpq command = [%s]\n",
sharename, current_printif->type, lpq_command)); sharename, current_printif->type, lpq_command));
@ -1426,6 +1432,11 @@ static void print_queue_update(int snum, BOOL force)
sent. */ sent. */
pdb = get_print_db_byname(sharename); pdb = get_print_db_byname(sharename);
if (!pdb) {
SAFE_FREE(buffer);
return;
}
snprintf(key, sizeof(key), "MSG_PENDING/%s", sharename); snprintf(key, sizeof(key), "MSG_PENDING/%s", sharename);
if ( !tdb_store_uint32( pdb->tdb, key, time(NULL) ) ) { if ( !tdb_store_uint32( pdb->tdb, key, time(NULL) ) ) {
@ -1731,6 +1742,10 @@ static BOOL remove_from_jobs_changed(const char* sharename, uint32 jobid)
BOOL ret = False; BOOL ret = False;
BOOL gotlock = False; BOOL gotlock = False;
if (!pdb) {
return False;
}
ZERO_STRUCT(data); ZERO_STRUCT(data);
key = string_tdb_data("INFO/jobs_changed"); key = string_tdb_data("INFO/jobs_changed");
@ -2057,11 +2072,14 @@ static int get_queue_status(const char* sharename, print_status_struct *status)
struct tdb_print_db *pdb = get_print_db_byname(sharename); struct tdb_print_db *pdb = get_print_db_byname(sharename);
int len; int len;
if (status) {
ZERO_STRUCTP(status);
}
if (!pdb) if (!pdb)
return 0; return 0;
if (status) { if (status) {
ZERO_STRUCTP(status);
fstr_sprintf(keystr, "STATUS/%s", sharename); fstr_sprintf(keystr, "STATUS/%s", sharename);
data = tdb_fetch(pdb->tdb, string_tdb_data(keystr)); data = tdb_fetch(pdb->tdb, string_tdb_data(keystr));
if (data.dptr) { if (data.dptr) {