[libvirt] [PATCH v2] Fixed NULL pointer check
This patch fixes a NULL pointer check that was causing SegFault on some specific configurations. --- src/util/conf.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/util/conf.c b/src/util/conf.c index 8ad60e0..3370337 100644 --- a/src/util/conf.c +++ b/src/util/conf.c @@ -1,7 +1,7 @@ /** * conf.c: parser for a subset of the Python encoded Xen configuration files * - * Copyright (C) 2006-2011 Red Hat, Inc. + * Copyright (C) 2006-2012 Red Hat, Inc. * * See COPYING.LIB for the License of this software * @@ -836,6 +836,9 @@ virConfGetValue(virConfPtr conf, const char *setting) { virConfEntryPtr cur; +if (conf == NULL) +return NULL; + cur = conf-entries; while (cur != NULL) { if ((cur-name != NULL) -- 1.7.3.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] Fixed NULL pointer check
On 19.03.2012 08:55, Martin Kletzander wrote: This patch fixes a NULL pointer check that was causing SegFault on some specific configurations. --- src/util/conf.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/util/conf.c b/src/util/conf.c index 8ad60e0..3370337 100644 --- a/src/util/conf.c +++ b/src/util/conf.c @@ -1,7 +1,7 @@ /** * conf.c: parser for a subset of the Python encoded Xen configuration files * - * Copyright (C) 2006-2011 Red Hat, Inc. + * Copyright (C) 2006-2012 Red Hat, Inc. * * See COPYING.LIB for the License of this software * @@ -836,6 +836,9 @@ virConfGetValue(virConfPtr conf, const char *setting) { virConfEntryPtr cur; +if (conf == NULL) +return NULL; + cur = conf-entries; while (cur != NULL) { if ((cur-name != NULL) Looking good, but I think we should revert 59d0c9801c1ab then. In addition - maybe we can set ATTRIBUTE_RETURN_CHECK to this function. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] Fixed NULL pointer check
On 03/19/2012 10:38 AM, Michal Privoznik wrote: On 19.03.2012 08:55, Martin Kletzander wrote: This patch fixes a NULL pointer check that was causing SegFault on some specific configurations. --- src/util/conf.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/util/conf.c b/src/util/conf.c index 8ad60e0..3370337 100644 --- a/src/util/conf.c +++ b/src/util/conf.c @@ -836,6 +836,9 @@ virConfGetValue(virConfPtr conf, const char *setting) { virConfEntryPtr cur; +if (conf == NULL) +return NULL; + cur = conf-entries; while (cur != NULL) { if ((cur-name != NULL) Looking good, but I think we should revert 59d0c9801c1ab then. In addition - maybe we can set ATTRIBUTE_RETURN_CHECK to this function. Yes, with this change the check added in that commit is redundant. Peter Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] Fixed NULL pointer check
At 03/19/2012 05:38 PM, Michal Privoznik Wrote: On 19.03.2012 08:55, Martin Kletzander wrote: This patch fixes a NULL pointer check that was causing SegFault on some specific configurations. --- src/util/conf.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/util/conf.c b/src/util/conf.c index 8ad60e0..3370337 100644 --- a/src/util/conf.c +++ b/src/util/conf.c @@ -1,7 +1,7 @@ /** * conf.c: parser for a subset of the Python encoded Xen configuration files * - * Copyright (C) 2006-2011 Red Hat, Inc. + * Copyright (C) 2006-2012 Red Hat, Inc. * * See COPYING.LIB for the License of this software * @@ -836,6 +836,9 @@ virConfGetValue(virConfPtr conf, const char *setting) { virConfEntryPtr cur; +if (conf == NULL) +return NULL; + cur = conf-entries; while (cur != NULL) { if ((cur-name != NULL) Looking good, but I think we should revert 59d0c9801c1ab then. I agree with reverting this commit. It does not fix all space. In addition - maybe we can set ATTRIBUTE_RETURN_CHECK to this function. Agree with it. Thanks Wen Congyang Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list