Bug 8589 - Uninitialized value error in open_tdb()
Uninitialized value error in open_tdb()
Status: NEW
Product: TDB
Classification: Unclassified
Component: libtdb
unspecified
All All
: P5 minor
: ---
Assigned To: Samba QA Contact
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-08 18:55 UTC by Stephen Gallagher
Modified: 2011-11-08 18:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Gallagher 2011-11-08 18:55:38 UTC
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}
Comment 1 Stephen Gallagher 2011-11-08 18:56:25 UTC
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}