[Winpt-commits] r293 - trunk/Src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Mar 12 21:47:35 CET 2007
Author: twoaday
Date: 2007-03-12 21:47:34 +0100 (Mon, 12 Mar 2007)
New Revision: 293
Modified:
trunk/Src/ChangeLog
trunk/Src/wptKeyserverDlg.cpp
trunk/Src/wptKeyserverSearchDlg.cpp
Log:
Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog 2007-03-12 20:37:13 UTC (rev 292)
+++ trunk/Src/ChangeLog 2007-03-12 20:47:34 UTC (rev 293)
@@ -1,6 +1,8 @@
2007-03-12 Timo Schulz <twoaday at gmx.net>
* wptVerifyList.cpp (extract_filename): Simplified.
+ * wptKeyserverSearchDlg.cpp (fetch_keys): Avoid possible memory
+ leak for some error cases.
2007-03-10 Timo Schulz <twoaday at gmx.net>
Modified: trunk/Src/wptKeyserverDlg.cpp
===================================================================
--- trunk/Src/wptKeyserverDlg.cpp 2007-03-12 20:37:13 UTC (rev 292)
+++ trunk/Src/wptKeyserverDlg.cpp 2007-03-12 20:47:34 UTC (rev 293)
@@ -1,5 +1,5 @@
/* wptKeyserverDlg.cpp - Keyserver dialog
- * Copyright (C) 2000-2006 Timo Schulz
+ * Copyright (C) 2000-2007 Timo Schulz
* Copyright (C) 2005, 2006 g10 Code GmbH
*
* This file is part of WinPT.
@@ -13,10 +13,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with WinPT; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -81,14 +77,13 @@
int
hkp_send_key (HWND dlg, const char *kserver, WORD port, const char *pattern)
{
- GPGME *gpg;
+ GPGME gpg;
gpgme_error_t ec;
char *rawkey = NULL;
char msg[256];
- gpg = new GPGME ();
- gpg->setArmor (true);
- ec = gpg->exportToBuffer (pattern, &rawkey);
+ gpg.setArmor (true);
+ ec = gpg.exportToBuffer (pattern, &rawkey);
if (ec) {
msg_box (dlg, gpgme_strerror (ec), _("Export"), MB_ERR);
goto leave;
@@ -101,11 +96,10 @@
goto leave;
}
- _snprintf (msg, sizeof (msg) -1, _("Key '%s' successfully sent"), pattern);
+ _snprintf (msg, DIM (msg) -1, _("Key '%s' successfully sent"), pattern);
status_box (dlg, msg, _("GnuPG status"));
leave:
- delete gpg;
free_if_alloc (rawkey);
return ec? -1 : 0;
}
@@ -176,7 +170,7 @@
{
gpgme_import_result_t import_res = NULL;
gpgme_error_t err;
- GPGME *gpg = NULL;
+ GPGME gpg;
char *rawkey = NULL;
size_t keylen = 0;
int rc;
@@ -213,14 +207,13 @@
msg_box (dlg, _("This is not a valid OpenPGP key."),
_("Keyserver"), MB_ERR);
goto leave;
- }
- gpg = new GPGME ();
- err = gpg->importFromBuffer (rawkey);
+ }
+ err = gpg.importFromBuffer (rawkey);
if (err) {
msg_box (dlg, gpgme_strerror (err), _("Import"), MB_ERR);
goto leave;
}
- import_res = gpg->importGetResult ();
+ import_res = gpg.importGetResult ();
if (import_res && r_fpr)
*r_fpr = m_strdup (import_res->imports->fpr);
@@ -236,8 +229,6 @@
leave:
free_if_alloc (rawkey);
- if (gpg != NULL)
- delete gpg;
return rc;
}
@@ -704,11 +695,11 @@
notify = (NMHDR *)lparam;
if (!notify)
break;
- if (notify->code == NM_CLICK
- && notify->idFrom == IDC_KEYSERVER_LIST)
+ if (notify->code == (UINT)NM_CLICK
+ && notify->idFrom == (UINT)IDC_KEYSERVER_LIST)
lv_idx = listview_get_curr_pos (lv);
- else if (notify->code == NM_RCLICK &&
- notify->idFrom == IDC_KEYSERVER_LIST) {
+ else if (notify->code == (UINT)NM_RCLICK &&
+ notify->idFrom == (UINT)IDC_KEYSERVER_LIST) {
POINT p;
GetCursorPos (&p);
HMENU hm, pop;
Modified: trunk/Src/wptKeyserverSearchDlg.cpp
===================================================================
--- trunk/Src/wptKeyserverSearchDlg.cpp 2007-03-12 20:37:13 UTC (rev 292)
+++ trunk/Src/wptKeyserverSearchDlg.cpp 2007-03-12 20:47:34 UTC (rev 293)
@@ -1,5 +1,5 @@
/* wptKeyserverSearchDlg.cpp - Keyserver Searching
- * Copyright (C) 2001-2006 Timo Schulz
+ * Copyright (C) 2001-2007 Timo Schulz
*
* This file is part of WinPT.
*
@@ -12,10 +12,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with WinPT; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -38,7 +34,6 @@
/* Default threshold for key items. */
#define MAX_N_KEYS 64
-
/* Symbolic column IDs. */
enum { KSS_COL_BITS = 0, KSS_COL_ALGO,
KSS_COL_KEYID, KSS_COL_DATE, KSS_COL_UID };
@@ -153,10 +148,9 @@
listview_get_item_text (lv, n, KSS_COL_KEYID, keyid, DIM (keyid)-1);
rc = hkp_recv_key2 (dlg, ksc->name, ksc->port, keyid, 0, &fpr);
- if (!rc && fpr != NULL) {
+ if (!rc && fpr != NULL)
keycache_update (0, fpr);
- free_if_alloc (fpr);
- }
+ free_if_alloc (fpr);
}
}
More information about the Winpt-commits
mailing list