From b4c0cfe3a4cbc17148c0d1d728666d70136b7e93 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Fri, 11 Aug 2017 13:46:14 -0700 Subject: Add malloc cast --- src/google/protobuf/compiler/subprocess.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/compiler/subprocess.cc b/src/google/protobuf/compiler/subprocess.cc index 2a8688d6..2e5a89ac 100644 --- a/src/google/protobuf/compiler/subprocess.cc +++ b/src/google/protobuf/compiler/subprocess.cc @@ -54,8 +54,8 @@ namespace compiler { namespace { char* portable_strdup(const char* s) { - char* ns = malloc(strlen(s) + 1); - if (ns) { + char* ns = (char*) malloc(strlen(s) + 1); + if (ns != NULL) { strcpy(ns, s); } return ns; -- cgit v1.2.3