Bug Summary

File:libglusterfs/src/ctx.c
Location:line 30, column 17
Description:Value stored to 'ret' is never read

Annotated Source Code

1/*
2 Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com>
3 This file is part of GlusterFS.
4
5 This file is licensed to you under your choice of the GNU Lesser
6 General Public License, version 3 or any later version (LGPLv3 or
7 later), or the GNU General Public License, version 2 (GPLv2), in all
8 cases as published by the Free Software Foundation.
9*/
10
11#ifndef _CONFIG_H
12#define _CONFIG_H
13#include "config.h"
14#endif /* !_CONFIG_H */
15
16#include <pthread.h>
17
18#include "glusterfs.h"
19
20glusterfs_ctx_t *
21glusterfs_ctx_new ()
22{
23 int ret = 0;
24 glusterfs_ctx_t *ctx = NULL((void*)0);
25
26 /* no GF_CALLOC here, gf_acct_mem_set_enable is not
27 yet decided at this point */
28 ctx = calloc (1, sizeof (*ctx));
29 if (!ctx) {
30 ret = -1;
Value stored to 'ret' is never read
31 goto out;
32 }
33
34 INIT_LIST_HEAD (&ctx->graphs)do { (&ctx->graphs)->next = (&ctx->graphs)->
prev = &ctx->graphs; } while (0)
;
35 INIT_LIST_HEAD (&ctx->mempool_list)do { (&ctx->mempool_list)->next = (&ctx->mempool_list
)->prev = &ctx->mempool_list; } while (0)
;
36
37 ctx->daemon_pipe[0] = -1;
38 ctx->daemon_pipe[1] = -1;
39
40 ret = pthread_mutex_init (&ctx->lock, NULL((void*)0));
41 if (ret) {
42 free (ctx);
43 ctx = NULL((void*)0);
44 }
45out:
46 return ctx;
47}
48