Author: mav
Date: Tue Jun 11 14:18:54 2019
New Revision: 348909
URL: https://svnweb.freebsd.org/changeset/base/348909

Log:
  MFC r348559: MFV r348537: 8601 memory leak in get_special_prop()
  
  illumos/illumos-gate@e19b450bec203d8be04447ea476d7a86b36d63a1
  
  Reviewed by: Serapheim Dimitropoulos <[email protected]>
  Reviewed by: Sara Hartse <[email protected]>
  Reviewed by: Pavel Zakharov <[email protected]>
  Reviewed by: Matt Ahrens <[email protected]>
  Reviewed by: Robert Mustacchi <[email protected]>
  Approved by: Dan McDonald <[email protected]>
  Author:     John Gallagher <[email protected]>

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c
==============================================================================
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c  Tue Jun 
11 14:18:04 2019        (r348908)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c  Tue Jun 
11 14:18:54 2019        (r348909)
@@ -14,7 +14,7 @@
  */
 
 /*
- * Copyright (c) 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2016, 2017 by Delphix. All rights reserved.
  */
 
 #include "lua.h"
@@ -431,16 +431,21 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, 
        case ZFS_PROP_INCONSISTENT:
                numval = dsl_get_inconsistent(ds);
                break;
-       case ZFS_PROP_RECEIVE_RESUME_TOKEN:
-               VERIFY3U(strlcpy(strval, get_receive_resume_stats_impl(ds),
-                   ZAP_MAXVALUELEN), <, ZAP_MAXVALUELEN);
+       case ZFS_PROP_RECEIVE_RESUME_TOKEN: {
+               char *token = get_receive_resume_stats_impl(ds);
+               VERIFY3U(strlcpy(strval, token, ZAP_MAXVALUELEN), <,
+                   ZAP_MAXVALUELEN);
+               strfree(token);
                if (strcmp(strval, "") == 0) {
-                       VERIFY3U(strlcpy(strval, get_child_receive_stats(ds),
-                           ZAP_MAXVALUELEN), <, ZAP_MAXVALUELEN);
+                       token = get_child_receive_stats(ds);
+                       VERIFY3U(strlcpy(strval, token, ZAP_MAXVALUELEN), <,
+                           ZAP_MAXVALUELEN);
+                       strfree(token);
                        if (strcmp(strval, "") == 0)
                                error = ENOENT;
                }
                break;
+       }
        case ZFS_PROP_VOLSIZE:
                ASSERT(ds_type == ZFS_TYPE_VOLUME);
                error = dmu_objset_from_ds(ds, &os);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to