From 6afb9a5b0db00fd065761c0c4df00302b14dbc4d Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Sun, 23 Oct 2016 12:49:42 +0200 Subject: [PATCH] Initialise target_t members on error paths This is a no-op from the point of view of the actual code flow, but not doing so can trigger false positives in some versions of GCC (4.9 from Jessie) at high optimisation levels (-O3). For an interesting discussion of why this happens at `-O3` vs. at `-O2`, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60165. Closes #13. --- xattr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xattr.c b/xattr.c index 09bb9a4..7e565f1 100644 --- a/xattr.c +++ b/xattr.c @@ -167,6 +167,8 @@ static int convert_obj(PyObject *myobj, target_t *tgt, int nofollow) { tgt->fd = fd; } else { PyErr_SetString(PyExc_TypeError, "argument must be string or int"); + tgt->type = T_PATH; + tgt->name = NULL; return -1; } return 0; -- 2.39.5