Detected by Coverity 5.5.1 against current (2011-11-08) samba master branch 233static void open_tdb(const char *tdbname) 234{ CID 11074: Uninitialized scalar variable (UNINIT)Declaring variable "log_ctx" without initializer. 235 struct tdb_logging_context log_ctx; 236 log_ctx.log_fn = tdb_log; 237 At conditional (1): "tdb" taking the true branch. 238 if (tdb) tdb_close(tdb); At conditional (2): "disable_mmap" taking the true branch. Using uninitialized value "log_ctx": field "log_ctx".log_private is uninitialized when calling "tdb_open_ex". [show details] 239 tdb = tdb_open_ex(tdbname, 0, disable_mmap?TDB_NOMMAP:0, O_RDWR, 0600, 240 &log_ctx, NULL); 241 if (!tdb) { 242 printf("Could not open %s: %s\n", tdbname, strerror(errno)); 243 } 244}
Also present in create_tdb() 220static void create_tdb(const char *tdbname) 221{ CID 11073: Uninitialized scalar variable (UNINIT)Declaring variable "log_ctx" without initializer. 222 struct tdb_logging_context log_ctx; 223 log_ctx.log_fn = tdb_log; 224 At conditional (1): "tdb" taking the true branch. 225 if (tdb) tdb_close(tdb); At conditional (2): "disable_mmap" taking the true branch. Using uninitialized value "log_ctx": field "log_ctx".log_private is uninitialized when calling "tdb_open_ex". [show details] 226 tdb = tdb_open_ex(tdbname, 0, TDB_CLEAR_IF_FIRST | (disable_mmap?TDB_NOMMAP:0), 227 O_RDWR | O_CREAT | O_TRUNC, 0600, &log_ctx, NULL); 228 if (!tdb) { 229 printf("Could not create %s: %s\n", tdbname, strerror(errno)); 230 } 231}
fixed in f25449b00a81bdb4010aed36d7c713513b70bcce and a6a0d238b368fd15ceb0237c2f9ff13c58b18fad