diff --git a/opencog/embodiment/Control/OperationalAvatarController/OCPlanner.cc b/opencog/embodiment/Control/OperationalAvatarController/OCPlanner.cc index a6e8b880504..f11c48b1726 100644 --- a/opencog/embodiment/Control/OperationalAvatarController/OCPlanner.cc +++ b/opencog/embodiment/Control/OperationalAvatarController/OCPlanner.cc @@ -823,7 +823,7 @@ ActionPlanID OCPlanner::doPlanning(const vector& goal,const vectorParamCandidates.size() == 0) { diff --git a/opencog/learning/clustering/blopex/fortran_matrix.c b/opencog/learning/clustering/blopex/fortran_matrix.c index 8b0e54d70a6..030d6857ecf 100644 --- a/opencog/learning/clustering/blopex/fortran_matrix.c +++ b/opencog/learning/clustering/blopex/fortran_matrix.c @@ -1535,6 +1535,7 @@ zutilities_FortranMatrixPrint( utilities_FortranMatrix* mtx, fprintf(fp,"%22.14e %22.14e \n",p->real,p->imag); p += jump; } + fclose(fp); return 0; } diff --git a/opencog/nlp/chatbot/go-irc.cc b/opencog/nlp/chatbot/go-irc.cc index 9730bb75a7d..3e793a88531 100644 --- a/opencog/nlp/chatbot/go-irc.cc +++ b/opencog/nlp/chatbot/go-irc.cc @@ -196,6 +196,7 @@ int got_privmsg(const char* params, irc_reply_data* ird, void* data) else { conn->privmsg (msg_target, "Shell escapes disabled in this chatbot version\n"); + free(cmdline); return 0; } #endif /* ENABLE_SHELL_ESCAPES */ diff --git a/opencog/persist/file/SavingLoading.cc b/opencog/persist/file/SavingLoading.cc index 5a21177976a..6f3ac9a00bd 100644 --- a/opencog/persist/file/SavingLoading.cc +++ b/opencog/persist/file/SavingLoading.cc @@ -276,6 +276,7 @@ void SavingLoading::load(const char *fileName, size_t rc = fread(&format, sizeof(char), 1, f); if (! (rc == 1 && format & FULL_NETWORK_DUMP)) { + fclose(f); throw RuntimeException(TRACE_INFO, "SavingLoading - invalid file format '%c'.", format); } diff --git a/opencog/spatial/LocalSpaceMap2D.cc b/opencog/spatial/LocalSpaceMap2D.cc index 6819ae4e0a1..8aeb4e08e9d 100644 --- a/opencog/spatial/LocalSpaceMap2D.cc +++ b/opencog/spatial/LocalSpaceMap2D.cc @@ -306,7 +306,7 @@ void LocalSpaceMap2D::load(FILE* fp) addObject(std::string(id), metadata, isObstacle ); - delete id; + delete [] id; } CHECK_FREAD; } diff --git a/opencog/util/cluster.c b/opencog/util/cluster.c index 4bf30c329ef..6d5ab55bd65 100644 --- a/opencog/util/cluster.c +++ b/opencog/util/cluster.c @@ -2677,6 +2677,7 @@ double** distancematrix (int nrows, int ncolumns, double** data, if (i < n) /* break condition encountered */ { j = i; for (i = 1; i < j; i++) free(matrix[i]); + free(matrix); return NULL; } diff --git a/opencog/util/tree.h b/opencog/util/tree.h index 378f8d76fe8..bf5c53ed278 100644 --- a/opencog/util/tree.h +++ b/opencog/util/tree.h @@ -1367,7 +1367,7 @@ typename tree::sibling_iterator tree::sibling_iterator treenext_sibling; @@ -1461,7 +1461,7 @@ iter tree::reparent(iter position, sibling_iterator begi last->next_sibling=0; tree_node *pos=first; - while(1==1) { + while(true) { pos->parent=position.node; if(pos==last) break; pos=pos->next_sibling;