zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject svn commit: r1759737 - in /zookeeper/branches/branch-3.4: CHANGES.txt src/c/src/recordio.c
Date Thu, 08 Sep 2016 02:58:04 GMT
Author: phunt
Date: Thu Sep  8 02:58:04 2016
New Revision: 1759737

URL: http://svn.apache.org/viewvc?rev=1759737&view=rev
Log:
ZOOKEEPER-2558: Potential memory leak in recordio.c (Michael Han via phunt)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/src/c/src/recordio.c

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1759737&r1=1759736&r2=1759737&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Thu Sep  8 02:58:04 2016
@@ -8,6 +8,9 @@ BUGFIXES:
   org.apache.zookeeper.server.quorum.CnxManagerTest.testCnxFromFutureVersion
   (Michael Han via phunt)
 
+  ZOOKEEPER-2558: Potential memory leak in recordio.c
+  (Michael Han via phunt)
+
 
 Release 3.4.9 - 2016-08-23
 

Modified: zookeeper/branches/branch-3.4/src/c/src/recordio.c
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/c/src/recordio.c?rev=1759737&r1=1759736&r2=1759737&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/c/src/recordio.c (original)
+++ zookeeper/branches/branch-3.4/src/c/src/recordio.c Thu Sep  8 02:58:04 2016
@@ -296,9 +296,11 @@ static struct oarchive oa_default = { ST
 
 struct iarchive *create_buffer_iarchive(char *buffer, int len)
 {
-    struct iarchive *ia = malloc(sizeof(*ia));
-    struct buff_struct *buff = malloc(sizeof(struct buff_struct));
+    struct iarchive *ia;
+    struct buff_struct *buff;
+    ia = malloc(sizeof(*ia));
     if (!ia) return 0;
+    buff = malloc(sizeof(struct buff_struct));
     if (!buff) {
         free(ia);
         return 0;
@@ -313,9 +315,11 @@ struct iarchive *create_buffer_iarchive(
 
 struct oarchive *create_buffer_oarchive()
 {
-    struct oarchive *oa = malloc(sizeof(*oa));
-    struct buff_struct *buff = malloc(sizeof(struct buff_struct));
+    struct oarchive *oa;
+    struct buff_struct *buff;
+    oa = malloc(sizeof(*oa));
     if (!oa) return 0;
+    buff = malloc(sizeof(struct buff_struct));
     if (!buff) {
         free(oa);
         return 0;



Mime
View raw message