Skip site navigation (1)Skip section navigation (2)
Date:      Wed,  9 Aug 2006 12:26:05 +0400 (MSD)
From:      Stanislav Sedov <ssedov@mbsd.msk.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        clsung@FreeBSD.org
Subject:   ports/101688: [PATCH] net-im/centericq: honor CFLAGS, fix memory leekage bugs
Message-ID:  <20060809082605.55AC812C61@fonon.realnet>
Resent-Message-ID: <200608090830.k798UGLS082639@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         101688
>Category:       ports
>Synopsis:       [PATCH] net-im/centericq: honor CFLAGS, fix memory leekage bugs
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 09 08:30:15 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Stanislav Sedov
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
MBSD labs, Inc.
>Environment:
System: FreeBSD fonon.realnet 7.0-CURRENT FreeBSD 7.0-CURRENT #1: Wed Aug  2 21:44:37 MSD
>Description:
- Respect CFLAGS
- Fix some annoying memory leekage bugs that tends to core dumps.

The following files was added:
- files/patch-kkconsui-0.1_src_texteditor.cc
- files/patch-kkstrtext-0.1_kkstrtext.cc
- files/patch-kkstrtext-0.1_kkstrtext.h
- files/patch-libicq2000-0.1_src_DirectClient.cpp
- files/patch-src_icqface.cc

Copy of this message was sent to (clsung@FreeBSD.org).

>How-To-Repeat:
>Fix:

--- centericq-4.21.0_4.patch begins here ---
diff -ruN --exclude=CVS /usr/ports/net-im/centericq/Makefile /var/tmp/centericq/Makefile
--- /usr/ports/net-im/centericq/Makefile	Thu May 11 13:07:15 2006
+++ /var/tmp/centericq/Makefile	Wed Aug  9 12:19:23 2006
@@ -8,7 +8,7 @@
 
 PORTNAME=	centericq
 PORTVERSION=	4.21.0
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	net-im
 MASTER_SITES=	http://centericq.de/archive/source/releases/ \
 		http://thekonst.net/download/
@@ -22,7 +22,7 @@
 USE_GMAKE=	yes
 GNU_CONFIGURE=	yes
 CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include" \
-		CXXFLAGS="-I${LOCALBASE}/include"
+		CXXFLAGS="-I${LOCALBASE}/include ${CXXFLAGS}"
 LDFLAGS+=	-L${LOCALBASE}/lib -lstdc++
 CONFIGURE_ARGS=	--with-openssl --disable-konst
 
diff -ruN --exclude=CVS /usr/ports/net-im/centericq/files/patch-kkconsui-0.1_src_texteditor.cc /var/tmp/centericq/files/patch-kkconsui-0.1_src_texteditor.cc
--- /usr/ports/net-im/centericq/files/patch-kkconsui-0.1_src_texteditor.cc	Thu Jan  1 03:00:00 1970
+++ /var/tmp/centericq/files/patch-kkconsui-0.1_src_texteditor.cc	Wed Aug  9 12:24:29 2006
@@ -0,0 +1,67 @@
+--- kkconsui-0.1/src/texteditor.cc.orig	Wed Aug  9 12:23:58 2006
++++ kkconsui-0.1/src/texteditor.cc	Wed Aug  9 12:24:17 2006
+@@ -106,7 +106,7 @@
+ 	fread(p, st.st_size, 1, f);
+ 	p[st.st_size] = 0;
+ 	i = load(p, strdup(id.c_str()));
+-	delete p;
++	delete[] p;
+     }
+ 
+     return i;
+@@ -124,7 +124,7 @@
+     f.read(buf, size);
+     buf[size] = 0;
+     ret = load(buf, strdup(id.c_str()));
+-    delete buf;
++    delete[] buf;
+ 
+     return ret;
+ }
+@@ -172,7 +172,7 @@
+ int texteditor::save(FILE *f, const char *linebreak) {
+     char *buf = save(linebreak);
+     fwrite(buf, strlen(buf), 1, f);
+-    delete buf;
++    free(buf);
+     modified = false;
+     return 0;
+ }
+@@ -180,7 +180,7 @@
+ int texteditor::save(ofstream &f, const string linebreak) {
+     char *buf = save(linebreak.c_str());
+     f.write(buf, strlen(buf));
+-    delete buf;
++    free(buf);
+     f.close();
+     modified = false;
+     return 0;
+@@ -526,7 +526,7 @@
+ 	fread(buf, fsize, 1, f);
+ 	buf[fsize] = 0;
+ 	insert(buf);
+-	delete buf;
++	delete[] buf;
+     }
+ }
+ 
+@@ -576,8 +576,8 @@
+ 	    firstpass = false;
+ 	}
+     
+-	delete el;
+-	delete sl;
++	free(el);
++	free(sl);
+ 
+ 	modification(uinsblock, sbuf);
+     }
+@@ -1081,7 +1081,7 @@
+ 			curfile->lines->replace(CURLINE, newline);
+ 		    }
+ 
+-		    delete anext;
++		    free(anext);
+ 		} else {
+ 		    if(next) nextlen = strlen(next); else nextlen = 0;
+ 		    char *newline = new char[nextlen+strlen(p)+1];
diff -ruN --exclude=CVS /usr/ports/net-im/centericq/files/patch-kkstrtext-0.1_kkstrtext.cc /var/tmp/centericq/files/patch-kkstrtext-0.1_kkstrtext.cc
--- /usr/ports/net-im/centericq/files/patch-kkstrtext-0.1_kkstrtext.cc	Thu Jan  1 03:00:00 1970
+++ /var/tmp/centericq/files/patch-kkstrtext-0.1_kkstrtext.cc	Wed Aug  9 10:50:28 2006
@@ -0,0 +1,40 @@
+--- kkstrtext-0.1/kkstrtext.cc.orig	Wed Aug  9 10:44:43 2006
++++ kkstrtext-0.1/kkstrtext.cc	Wed Aug  9 10:50:27 2006
+@@ -154,7 +154,7 @@
+     string r;
+     char *buf = (char *) utf8_to_str(text.c_str());
+     r = buf;
+-    delete buf;
++    delete[] buf;
+     return r;
+ }
+ 
+@@ -162,7 +162,7 @@
+     string r;
+     char *buf = str_to_utf8(text.c_str());
+     r = buf;
+-    delete buf;
++    delete[] buf;
+     return r;
+ }
+ 
+@@ -416,7 +416,7 @@
+ 
+ void charpointerfree(void *p) {
+     char *cp = (char *) p;
+-    if(cp) delete cp;
++    if(cp) free(cp);
+ }
+ 
+ void nothingfree(void *p) {
+@@ -907,8 +907,8 @@
+ 	    r += soutbuf;
+ 	    text.erase(0, text.size()-inleft);
+ 
+-	    delete soutbuf;
+-	    delete sinbuf;
++	    delete[] soutbuf;
++	    free(sinbuf);
+ 
+ 	    if(res == -1 && errno != EILSEQ)
+ 		break;
diff -ruN --exclude=CVS /usr/ports/net-im/centericq/files/patch-kkstrtext-0.1_kkstrtext.h /var/tmp/centericq/files/patch-kkstrtext-0.1_kkstrtext.h
--- /usr/ports/net-im/centericq/files/patch-kkstrtext-0.1_kkstrtext.h	Thu Jan  1 03:00:00 1970
+++ /var/tmp/centericq/files/patch-kkstrtext-0.1_kkstrtext.h	Wed Aug  9 10:51:33 2006
@@ -0,0 +1,11 @@
+--- kkstrtext-0.1/kkstrtext.h.orig	Wed Aug  9 10:50:49 2006
++++ kkstrtext-0.1/kkstrtext.h	Wed Aug  9 10:51:12 2006
+@@ -87,7 +87,7 @@
+     { \
+ 	va_list vgs__ap; char vgs__buf[1024]; \
+ 	va_start(vgs__ap, fmt); \
+-	vsprintf(vgs__buf, fmt, vgs__ap); c = vgs__buf; \
++	vsnprintf(vgs__buf, sizeof(vgs__buf), fmt, vgs__ap); c = vgs__buf; \
+ 	va_end(vgs__ap); \
+     }
+ 
diff -ruN --exclude=CVS /usr/ports/net-im/centericq/files/patch-libicq2000-0.1_src_DirectClient.cpp /var/tmp/centericq/files/patch-libicq2000-0.1_src_DirectClient.cpp
--- /usr/ports/net-im/centericq/files/patch-libicq2000-0.1_src_DirectClient.cpp	Thu Jan  1 03:00:00 1970
+++ /var/tmp/centericq/files/patch-libicq2000-0.1_src_DirectClient.cpp	Wed Aug  9 10:53:56 2006
@@ -0,0 +1,11 @@
+--- libicq2000-0.1/src/DirectClient.cpp.orig	Wed Aug  9 10:52:04 2006
++++ libicq2000-0.1/src/DirectClient.cpp	Wed Aug  9 10:53:26 2006
+@@ -162,6 +162,8 @@
+ 
+       m_recv.setLittleEndian();
+       m_recv >> length;
++      if (length == 0)
++		return;
+       if (length > Incoming_Packet_Limit) throw ParseException("Received too long incoming packet");
+       if (m_recv.remains() < length) return; // waiting for more of the packet
+ 
diff -ruN --exclude=CVS /usr/ports/net-im/centericq/files/patch-src_icqface.cc /var/tmp/centericq/files/patch-src_icqface.cc
--- /usr/ports/net-im/centericq/files/patch-src_icqface.cc	Thu Jan  1 03:00:00 1970
+++ /var/tmp/centericq/files/patch-src_icqface.cc	Wed Aug  9 10:44:32 2006
@@ -0,0 +1,11 @@
+--- src/icqface.cc.orig	Wed Aug  9 10:43:40 2006
++++ src/icqface.cc	Wed Aug  9 10:44:14 2006
+@@ -2003,7 +2003,7 @@
+ 	    mvaddchnstr(i-1, sizeWArea.x1+1, logline, sizeWArea.x2-sizeWArea.x1);
+ 	}
+ 
+-	delete logline;
++	delete[] logline;
+ 
+ 	if(text.size() > sizeWArea.x2-sizeWArea.x1-2) text.resize(sizeWArea.x2-sizeWArea.x1-2);
+ 	mvhline(LINES-3, sizeWArea.x1+2, ' ', sizeWArea.x2-sizeWArea.x1-2);
--- centericq-4.21.0_4.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060809082605.55AC812C61>