[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [v0.9.12-maint 08/11] Make sure regree is called close to it's usage



Hi Eric,
I wasn't aware that my patch had been posted upstream.

On Wed, Sep 11, 2013 at 02:46:08PM -0600, Eric Blake wrote:
> On 09/11/2013 08:00 AM, Luca Tettamanti wrote:
> > This is a backport of 71da3b66a8455faf8019effe3cf504a31f91f54a.
> > ---
> >  src/storage/storage_backend_logical.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> This is not identical to the contents of 71da3b6 (it's missing the last
> hunk, but then again, that was a revert of afc4631, so it works out in
> the end).

The original description[1] mentioned that:

"This bug has already been fixed upstream with commit 71da3b66 (which
also reverts afc4631b)."

I guess it was lost along the way.

> I'm okay with having one patch instead of two, but it's
> probably worth respinning this patch to use the usual cherry-pick
> notation and preservation of the original commit contents; as well as
> explicitly mentioning that the backport skips afc4631 and then its
> reversion.

Ok, something like this then?

>From 4b2a860148a3e9f41136f135449d5aa53b5824e9 Mon Sep 17 00:00:00 2001
From: John Ferlan <jferlan redhat com>
Date: Thu, 10 Jan 2013 14:44:26 -0500
Subject: [PATCH] storage: Need to also VIR_FREE(reg)

Commit-id 'afc4631b' added the regfree(reg) to free resources alloc'd
during regcomp; however, reg still needed to be VIR_FREE()'d. The call
to regfree() also didn't account for possible NULL value.  Reformatted
the call to be closer to usage.
(cherry picked from commit 71da3b66a8455faf8019effe3cf504a31f91f54a)

Backported to 0.9.12 with afc4631b and its revert skipped.

Signed-off-by: Luca Tettamanti <ltettamanti acunu com>
---
 src/storage/storage_backend_logical.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 9a91dd9..a4ec8ff 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -204,15 +204,18 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
     if (err != 0) {
         char error[100];
         regerror(err, reg, error, sizeof(error));
+        regfree(reg);
         virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Failed to compile regex %s"),
                               error);
         goto cleanup;
     }
 
-    if (regexec(reg, groups[3], nvars, vars, 0) != 0) {
-        virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                              _("malformed volume extent devices value"));
+    err = regexec(reg, groups[3], nvars, vars, 0);
+    regfree(reg);
+    if (err != 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("malformed volume extent devices value"));
         goto cleanup;
     }
 

Luca
[1]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705205


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]