浏览代码

libdpkg: Initialize ps->pkg and ps->pkgbin to NULL in parse_open()

This guarantees the parsedb_state variable is in a sane state after
the parse_open() call.
Guillem Jover 15 年之前
父节点
当前提交
fb18783ce2
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      lib/dpkg/parse.c

+ 2 - 0
lib/dpkg/parse.c

@@ -315,6 +315,8 @@ parse_open(struct parsedb_state *ps, const char *filename,
   ps->filename = filename;
   ps->flags = flags;
   ps->lno = 0;
+  ps->pkg = NULL;
+  ps->pkgbin = NULL;
 
   fd = open(filename, O_RDONLY);
   if (fd == -1)