From 0fe3340ed9438f70c0e588956bf2d03faae2adde Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 2 Mar 2009 10:26:37 +0000 Subject: [PATCH] plug two config-parsing leaks * src/storage_conf.c (virStoragePoolDefParsePerms): Free mode string. (virStorageVolDefParsePerms): Likewise. * AUTHORS: Update. Patch by Ryota Ozaki. --- AUTHORS | 1 + ChangeLog | 6 ++++++ src/storage_conf.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/AUTHORS b/AUTHORS index 29585df193..1c87003556 100644 --- a/AUTHORS +++ b/AUTHORS @@ -59,6 +59,7 @@ Patches have also been contributed by: Itamar Heim Dave Allan Markus Armbruster + Ryota Ozaki [....send patches to get your name here....] diff --git a/ChangeLog b/ChangeLog index 5675b082f1..18bebae211 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ Mon Mar 2 10:16:04 +0100 2009 Jim Meyering + plug two config-parsing leaks + * src/storage_conf.c (virStoragePoolDefParsePerms): Free mode string. + (virStorageVolDefParsePerms): Likewise. + Patch by Ryota Ozaki. + * AUTHORS: Update. + don't dereference uninitialized pointer * src/storage_conf.c (virStoragePoolDefParsePerms): Initialize "ptr" to NULL. diff --git a/src/storage_conf.c b/src/storage_conf.c index 4a53ff49b5..46bde6f7d3 100644 --- a/src/storage_conf.c +++ b/src/storage_conf.c @@ -383,6 +383,7 @@ virStoragePoolDefParsePerms(virConnectPtr conn, } else { char *end = NULL; perms->mode = strtol(mode, &end, 8); + VIR_FREE(mode); if (*end || perms->mode < 0 || perms->mode > 0777) { virStorageReportError(conn, VIR_ERR_XML_ERROR, "%s", _("malformed octal mode")); @@ -812,6 +813,7 @@ virStorageVolDefParsePerms(virConnectPtr conn, } else { char *end = NULL; perms->mode = strtol(mode, &end, 8); + VIR_FREE(mode); if (*end || perms->mode < 0 || perms->mode > 0777) { virStorageReportError(conn, VIR_ERR_XML_ERROR, "%s", _("malformed octal mode"));