lib/core: Init struct stat buffer
authorColin Walters <walters@verbum.org>
Wed, 4 Oct 2017 14:22:05 +0000 (10:22 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 4 Oct 2017 14:56:31 +0000 (14:56 +0000)
Regression from d57410a7e62dcb89321807dcb2d91c85f9d26df7

Fixes Coverity CID #1457316

Closes: #1249
Approved by: jlebon

src/libostree/ostree-core.c

index 08c2892484122f3d24fb9142522b5fc40f76c7a7..7fa051f2ff224f8c15fe79521ecbcc72b2f311bf 100644 (file)
@@ -1614,10 +1614,13 @@ _ostree_gfileinfo_equal (GFileInfo *a, GFileInfo *b)
   return TRUE;
 }
 
+/* Many parts of libostree only care about mode,uid,gid - this creates
+ * a new GFileInfo with those fields see.
+ */
 GFileInfo *
 _ostree_mode_uidgid_to_gfileinfo (mode_t mode, uid_t uid, gid_t gid)
 {
-  struct stat stbuf;
+  struct stat stbuf = { 0, };
   stbuf.st_mode = mode;
   stbuf.st_uid = uid;
   stbuf.st_gid = gid;