|
|
020281 |
From 7acf0fad0ca468f33f86084f36251df5baf3dc94 Mon Sep 17 00:00:00 2001
|
|
|
020281 |
From: Jakub Hrozek <jakub.hrozek@posteo.se>
|
|
|
020281 |
Date: Wed, 26 Sep 2018 21:01:59 +0200
|
|
|
020281 |
Subject: [PATCH 5/7] files.c: Init char *name to NULL
|
|
|
020281 |
|
|
|
020281 |
Merges:
|
|
|
020281 |
https://pagure.io/libuser/issue/27
|
|
|
020281 |
|
|
|
020281 |
This is mostly to silence coverity warnings. "enum lu_entity_type" has
|
|
|
020281 |
three values and several places in the code follow logic as:
|
|
|
020281 |
|
|
|
020281 |
char *name;
|
|
|
020281 |
if ent->type == user:
|
|
|
020281 |
name = foo()
|
|
|
020281 |
if ent->type == group
|
|
|
020281 |
name = bar()
|
|
|
020281 |
g_assert(name != NULL)
|
|
|
020281 |
|
|
|
020281 |
it shouldn't be possible for ent->type to be anything else but in the
|
|
|
020281 |
odd case it is, initializing name to NULL will ensure that name will be
|
|
|
020281 |
still NULL after the code falls through the conditions and at least the
|
|
|
020281 |
behaviour is defined.
|
|
|
020281 |
---
|
|
|
020281 |
modules/files.c | 6 +++---
|
|
|
020281 |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
020281 |
|
|
|
020281 |
diff --git a/modules/files.c b/modules/files.c
|
|
|
020281 |
index 6a7787e28112ba07e0fc44f2887ce1d1540af29e..8c2a282b6448bbfb313b5d4f5eeb28b8240bccd5 100644
|
|
|
020281 |
--- a/modules/files.c
|
|
|
020281 |
+++ b/modules/files.c
|
|
|
020281 |
@@ -1501,7 +1501,7 @@ generic_lock(struct lu_module *module, const char *file_suffix, int field,
|
|
|
020281 |
struct lu_ent *ent, enum lock_op op, struct lu_error **error)
|
|
|
020281 |
{
|
|
|
020281 |
struct editing *e;
|
|
|
020281 |
- char *value, *new_value, *name;
|
|
|
020281 |
+ char *value, *new_value, *name = NULL;
|
|
|
020281 |
gboolean commit = FALSE, ret = FALSE;
|
|
|
020281 |
|
|
|
020281 |
/* Get the name which keys the entries of interest in the file. */
|
|
|
020281 |
@@ -1561,7 +1561,7 @@ generic_is_locked(struct lu_module *module, const char *file_suffix,
|
|
|
020281 |
int field, struct lu_ent *ent, struct lu_error **error)
|
|
|
020281 |
{
|
|
|
020281 |
char *filename;
|
|
|
020281 |
- char *value, *name;
|
|
|
020281 |
+ char *value, *name = NULL;
|
|
|
020281 |
int fd;
|
|
|
020281 |
gboolean ret = FALSE;
|
|
|
020281 |
|
|
|
020281 |
@@ -1752,7 +1752,7 @@ generic_setpass(struct lu_module *module, const char *file_suffix, int field,
|
|
|
020281 |
struct lu_error **error)
|
|
|
020281 |
{
|
|
|
020281 |
struct editing *e;
|
|
|
020281 |
- char *value, *name;
|
|
|
020281 |
+ char *value, *name = NULL;
|
|
|
020281 |
gboolean ret = FALSE;
|
|
|
020281 |
|
|
|
020281 |
/* Get the name of this account. */
|
|
|
020281 |
--
|
|
|
020281 |
2.14.4
|
|
|
020281 |
|