diff options
author | Chris Fallin <cfallin@c1f.net> | 2015-01-09 15:29:45 -0800 |
---|---|---|
committer | Chris Fallin <cfallin@c1f.net> | 2015-01-09 15:37:55 -0800 |
commit | 4c92289766d76f276b322ab254ef039f670f41b1 (patch) | |
tree | 92d8ad529bc1d27139134befb506dfd5905a1dbf /ruby/ext/google/protobuf_c/upb.c | |
parent | 80276ac0218f6d8fcdbad0fb09b233b31d2bc0fb (diff) | |
download | protobuf-4c92289766d76f276b322ab254ef039f670f41b1.tar.gz protobuf-4c92289766d76f276b322ab254ef039f670f41b1.tar.bz2 protobuf-4c92289766d76f276b322ab254ef039f670f41b1.zip |
Addressed code-review comments.
Diffstat (limited to 'ruby/ext/google/protobuf_c/upb.c')
-rw-r--r-- | ruby/ext/google/protobuf_c/upb.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ruby/ext/google/protobuf_c/upb.c b/ruby/ext/google/protobuf_c/upb.c index 0015aad1..abea7711 100644 --- a/ruby/ext/google/protobuf_c/upb.c +++ b/ruby/ext/google/protobuf_c/upb.c @@ -3420,8 +3420,10 @@ char *upb_strdup2(const char *s, size_t len) { // have a null-terminating byte since it may be a raw binary buffer. size_t n = len + 1; char *p = malloc(n); - if (p) memcpy(p, s, len); - p[len] = 0; + if (p) { + memcpy(p, s, len); + p[len] = 0; + } return p; } |