Discussion:
[Libstoragemgmt-devel] [PATCH 1/4] lsm_datatype.cpp: lsmErrorCreate correction
Tony Asleson
2014-03-04 01:44:25 UTC
Permalink
Used incorrect variable when creating the storage for
the additional debug data which resulted in us overwriting
the debug message.

Signed-off-by: Tony Asleson <***@redhat.com>
---
src/lsm_datatypes.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/lsm_datatypes.cpp b/src/lsm_datatypes.cpp
index d2064ea..7ec0ef2 100644
--- a/src/lsm_datatypes.cpp
+++ b/src/lsm_datatypes.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -360,11 +360,11 @@ lsmErrorPtr lsmErrorCreate(lsmErrorNumber code, lsmErrorDomain domain,
* allocate the storage for the debug data.
*/
if (debug_data && (debug_data_size > 0)) {
- err->debug = (char *)malloc(debug_data_size);
+ err->debug_data = malloc(debug_data_size);

- if (debug) {
+ if (err->debug_data) {
err->debug_data_size = debug_data_size;
- memcpy(err->debug, debug, debug_data_size);
+ memcpy(err->debug_data, debug_data, debug_data_size);
}
}
}
--
1.8.2.1
Loading...