Skip to content

Commit

Permalink
The memory allocated for info.buffer has been done with malloc().
Browse files Browse the repository at this point in the history
  • Loading branch information
phniix committed Nov 5, 2021
1 parent 244afdd commit 54893b0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Mp3Decoder.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
Copyright (c) 2019, Dimitri Diakopoulos All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand All @@ -37,6 +37,7 @@ using namespace nqr;
#include "minimp3/minimp3.h"
#include "minimp3/minimp3_ex.h"

#include <cstdlib>
#include <cstring>

void mp3_decode_internal(AudioData * d, const std::vector<uint8_t> & fileData)
Expand All @@ -55,7 +56,7 @@ void mp3_decode_internal(AudioData * d, const std::vector<uint8_t> & fileData)
d->samples.resize(info.samples);
std::memcpy(d->samples.data(), info.buffer, sizeof(float) * info.samples);

delete info.buffer;
std::free(info.buffer);
}

//////////////////////
Expand Down

0 comments on commit 54893b0

Please sign in to comment.