Skip to content

Commit

Permalink
dev[fix]: remove all alloc replace to malloc
Browse files Browse the repository at this point in the history
  • Loading branch information
neudinger committed Mar 5, 2022
1 parent 1e9e204 commit 6d666a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ __version__.py
pydockrmsd.egg-info/
core
dockrmsd.c
DockRMSD
DockRMSD
a.out
6 changes: 2 additions & 4 deletions pydockrmsd/DockRMSD_sources/DockRMSD.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#include <float.h>
#include <stdio.h> /* needed for vsnprintf */
#include <stdlib.h> /* needed for malloc-free */
Expand Down Expand Up @@ -679,7 +676,7 @@ DockRMSD assignAtoms(char **tempatom, char ***tempbond,
DockRMSD rmsd)
{
int **allcands = (int **)malloc(sizeof(int *) * atomcount); // List of all atoms in the template that could feasibly be each query atom
int *candcounts = (int *)alloca(atomcount * sizeof(int *)); // Number of atoms in the template that could feasibly be each query atom
int *candcounts = (int *)malloc(atomcount * sizeof(int)); // Number of atoms in the template that could feasibly be each query atom
// Iterate through each query atom and determine which template atoms correspond to the query
for (int i = 0; i < atomcount; i++)
{
Expand Down Expand Up @@ -852,6 +849,7 @@ DockRMSD assignAtoms(char **tempatom, char ***tempbond,
rmsd.optimal_mapping = optimal_mapping;
for (int i = 0; i < atomcount; i++)
free(allcands[i]);
free(candcounts);
free(allcands);
free(assign);
free(bestassign);
Expand Down

0 comments on commit 6d666a0

Please sign in to comment.