]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: initialize on-disk header in ImageCtx ctor
authorJosh Durgin <josh.durgin@inktank.com>
Mon, 24 Sep 2012 20:32:11 +0000 (13:32 -0700)
committerSamuel Just <sam.just@inktank.com>
Tue, 25 Sep 2012 21:09:27 +0000 (14:09 -0700)
CID 717224: Uninitialized scalar field (UNINIT_CTOR)
At (26): Non-static class member field "header.snaps" is not
initialized in this constructor nor in any functions that it calls.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
src/librbd/ImageCtx.cc

index 33baf5f613577721aa31eb2c3ce4bb5b69a21155..110b86d4e3569c8469b5b38753b52b54f0699c60 100644 (file)
@@ -50,6 +50,8 @@ namespace librbd {
     md_ctx.dup(p);
     data_ctx.dup(p);
 
+    memset(&header, 0, sizeof(header));
+
     string pname = string("librbd-") + id + string("-") +
       data_ctx.get_pool_name() + string("/") + name;
     if (snap) {