mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
scripting, remove free
This commit is contained in:
parent
8a49cb84a2
commit
0234ca5654
3 changed files with 33 additions and 37 deletions
|
@ -95,7 +95,7 @@ int GetModels(char *Models[], int *count, uint8_t *width){
|
|||
for (int mode = 0; mode < *count; ++mode) {
|
||||
mbynum(&model, mode);
|
||||
mcanon(&model);
|
||||
size_t size = (model.name && *model.name) ? strlen(model.name) : 6;
|
||||
size_t size = (model.name && *model.name) ? strlen(model.name) : 7;
|
||||
char *tmp = calloc(size+1, sizeof(char));
|
||||
if (tmp==NULL)
|
||||
return uerr("[!] out of memory?");
|
||||
|
@ -171,7 +171,7 @@ int GetModels(char *Models[], int *count, uint8_t *width){
|
|||
/* the selected model solved all arguments */
|
||||
mcanon(&pset);
|
||||
|
||||
size_t size = (pset.name && *pset.name) ? strlen(pset.name) : 6;
|
||||
size_t size = (pset.name && *pset.name) ? strlen(pset.name) : 7;
|
||||
//PrintAndLog("Size: %d, %s, count: %d",size,pset.name, Cnt);
|
||||
char *tmp = calloc(size+1, sizeof(char));
|
||||
if (tmp == NULL){
|
||||
|
|
|
@ -762,8 +762,8 @@ int mbynam(model_t *dest, const char *key) {
|
|||
|
||||
if (!aliases->name)
|
||||
return(-1);
|
||||
if(!(ukey = malloc((size_t) 1 + strlen(key)))) {
|
||||
uerror("cannot allocate memory for comparison string");
|
||||
if (!(ukey = malloc((size_t) 1 + strlen(key) + 1))) {
|
||||
uerror("[!] cannot allocate memory for comparison string");
|
||||
return(0);
|
||||
}
|
||||
uptr = ukey;
|
||||
|
@ -873,7 +873,6 @@ void mmatch(model_t *model, int flags) {
|
|||
}
|
||||
|
||||
/* Private functions */
|
||||
|
||||
static void munpack(model_t *dest, const struct mpreset *src) {
|
||||
/* Copies the parameters of src to dest.
|
||||
* dest must be an initialised model.
|
||||
|
|
|
@ -466,9 +466,6 @@ static int l_reveng_models(lua_State *L){
|
|||
|
||||
int ans = GetModels(models, &count, width);
|
||||
if (!ans) {
|
||||
for (int i =0; i<102; i++) {
|
||||
free(models[i]);
|
||||
}
|
||||
return returnToLuaWithError(L, "Didn't find any models");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue