summaryrefslogtreecommitdiff
path: root/indra/llinventory/llinventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llinventory/llinventory.cpp')
-rw-r--r--indra/llinventory/llinventory.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 4dddd9de3e..2823cf7be9 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -1257,23 +1257,19 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
// Early exit on an empty binary bucket.
if (bin_bucket_size <= 1) return;
- // Convert the bin_bucket into a string.
- char* item_buffer = new char[bin_bucket_size+1];
- if ((item_buffer != NULL) && (bin_bucket != NULL))
- {
- memcpy(item_buffer, bin_bucket, bin_bucket_size); /* Flawfinder: ignore */
- }
- else
+ if (NULL == bin_bucket)
{
- llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
- delete[] item_buffer;
+ llerrs << "unpackBinaryBucket failed. bin_bucket is NULL." << llendl;
return;
}
+
+ // Convert the bin_bucket into a string.
+ std::vector<char> item_buffer(bin_bucket_size+1);
+ memcpy(&item_buffer[0], bin_bucket, bin_bucket_size); /* Flawfinder: ignore */
item_buffer[bin_bucket_size] = '\0';
- std::string str(item_buffer);
+ std::string str(&item_buffer[0]);
- lldebugs << "item buffer: " << item_buffer << llendl;
- delete[] item_buffer;
+ lldebugs << "item buffer: " << str << llendl;
// Tokenize the string.
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;