Skip to content

Commit eb70b34

Browse files
bcsghcopybara-github
authored andcommitted
Avoid a 'may be used uninitialized' warning when built with '-c opt'. (#15846)
The motivation for this is first that under some combinations of flags it breaks builds and second it's trivial (and possibly zero runtime cost) to fix. It looks like the possibly bad case "should never happen", but converting this to a null pointer in the error case (which should at least make the failure less problematic) is cheap. Closes #15846 COPYBARA_INTEGRATE_REVIEW=#15846 from bcsgh:bcsgh/uninitialized 321d649 PiperOrigin-RevId: 607404168
1 parent a938b59 commit eb70b34

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/google/protobuf/arena.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ SizedPtr SerialArena::Free(Deallocator deallocator) {
193193
PROTOBUF_NOINLINE
194194
void* SerialArena::AllocateAlignedFallback(size_t n) {
195195
AllocateNewBlock(n);
196-
void* ret;
196+
void* ret = nullptr;
197197
bool res = MaybeAllocateAligned(n, &ret);
198198
ABSL_DCHECK(res);
199199
return ret;

0 commit comments

Comments
 (0)