aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-26 20:02:25 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-26 20:02:25 +0200
commit1af393838b4c9c5491035403af4c42c0e10f3846 (patch)
tree1973be1b90a873c1a67b98b310824cfce747ec7c
parentupdate dist (diff)
downloadbus-1af393838b4c9c5491035403af4c42c0e10f3846.tar.gz
bus-1af393838b4c9c5491035403af4c42c0e10f3846.tar.bz2
bus-1af393838b4c9c5491035403af4c42c0e10f3846.tar.xz
m bug: wrote to array before checking that it was successfully allocated
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/bus.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bus.c b/src/bus.c
index 7609de6..3205e25 100644
--- a/src/bus.c
+++ b/src/bus.c
@@ -262,9 +262,9 @@ create_semaphores(bus_t *bus)
/* Initialise the array. */
values.array = calloc((size_t)BUS_SEMAPHORES, sizeof(unsigned short));
- values.array[X] = 1;
if (!values.array)
goto fail;
+ values.array[X] = 1;
if (semctl(id, 0, SETALL, values.array) == -1)
goto fail;
free(values.array);