]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: check that realloc succeeded
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 22 Aug 2012 17:04:59 +0000 (10:04 -0700)
committerSage Weil <sage@inktank.com>
Thu, 27 Sep 2012 20:31:48 +0000 (13:31 -0700)
Was missing a test after a realloc.

Backport: argonaut
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_xml.cc

index fd3b6f6dea3bdddea39e00ab8198bd0491ae703e..c94b82e30fa633272e51a98d5fd62d6039f9a4fd 100644 (file)
@@ -208,6 +208,8 @@ bool RGWXMLParser::parse(const char *_buf, int len, int done)
 {
   int pos = buf_len;
   buf = (char *)realloc(buf, buf_len + len);
+  if (!buf)
+    return false;
   memcpy(&buf[buf_len], _buf, len);
   buf_len += len;