[irstlm] 56/78: fixed bug related to NULL pointer variable

Giulio Paci giuliopaci-guest at moszumanska.debian.org
Tue May 17 07:47:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

giuliopaci-guest pushed a commit to tag adaptiveLM.v0.10
in repository irstlm.

commit 31f7604554f97a4c2b0cb31b74549934cdd7dca7
Author: Nicola Bertoldi <bertoldi at fbk.eu>
Date:   Tue Dec 1 10:07:59 2015 +0100

    fixed bug related to NULL pointer variable
---
 src/lmtable.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/lmtable.cpp b/src/lmtable.cpp
index a35986d..e5a7cc8 100644
--- a/src/lmtable.cpp
+++ b/src/lmtable.cpp
@@ -2278,7 +2278,7 @@ namespace irstlm {
 	//non recursive version
 	const char *lmtable::maxsuffptr(ngram ong, unsigned int* size)
 	{
-		VERBOSE(3,"const char *lmtable::maxsuffptr(ngram ong, unsigned int* size)\n");
+		VERBOSE(3,"const char *lmtable::maxsuffptr(ngram ong, unsigned int* size) ong:|" << ong << "|\n");
 		
 		if (ong.size==0) {
 			if (size!=NULL) *size=0;
@@ -2326,7 +2326,7 @@ namespace irstlm {
 	
 	const char *lmtable::cmaxsuffptr(ngram ong, unsigned int* size)
 	{
-		VERBOSE(3,"const char *lmtable::maxsuffptr(ngram ong, unsigned int* size) ong:|" << ong  << "|\n");
+		VERBOSE(3,"const char *lmtable::cmaxsuffptr(ngram ong, unsigned int* size) ong:|" << ong  << "|\n");
 		
 		if (ong.size==0) {
 			if (size!=NULL) *size=0;
@@ -2383,9 +2383,10 @@ namespace irstlm {
 	ngram_state_t lmtable::maxsuffidx(ngram ong, unsigned int* size)
 	{
 		VERBOSE(3,"ngram_state_t lmtable::maxsuffidx(ngram ong, unsigned int* size)\n");
-		
-		const char* suffptr = cmaxsuffptr(ong,size);
-		return convert(suffptr,*size);
+		unsigned int isize; //internal state size variable
+		const char* suffptr = cmaxsuffptr(ong,&isize);
+		if (size != NULL){ *size = isize; }
+		return convert(suffptr,isize);
 	}
 	
 	ngram_state_t lmtable::cmaxsuffidx(ngram ong, unsigned int* size)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/irstlm.git



More information about the debian-science-commits mailing list