]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/ceph_argparse: fix malloc failure check
authorSage Weil <sage@inktank.com>
Fri, 16 Nov 2012 22:19:25 +0000 (14:19 -0800)
committerSage Weil <sage@inktank.com>
Fri, 16 Nov 2012 22:19:25 +0000 (14:19 -0800)
CID 743418 (#1 of 1): Dereference before null check (REVERSE_INULL)
Null-checking "argv" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/ceph_argparse.cc

index 421fc3399e2ee35b0e3f1a34ad2be5d8b3b363aa..646931acdc9ee54d4e8a48d2b48b37456328ee92 100644 (file)
@@ -82,7 +82,7 @@ void vec_to_argv(const char *argv0, std::vector<const char*>& args,
                  int *argc, const char ***argv)
 {
   *argv = (const char**)malloc(sizeof(char*) * (args.size() + 1));
-  if (!argv)
+  if (!*argv)
     throw bad_alloc();
   *argc = 1;
   (*argv)[0] = argv0;