]> code.citadel.org Git - citadel.git/commitdiff
Applied matt's patches to clean up memory leaks in the client
authorArt Cancro <ajc@citadel.org>
Thu, 12 Apr 2007 20:16:22 +0000 (20:16 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 12 Apr 2007 20:16:22 +0000 (20:16 +0000)
citadel/citadel.c
citadel/citadel_ipc.c
citadel/messages.c
citadel/routines2.c

index c2f0234dc0064e6450f9a4304a74e4e9eff5634b..37b65790bb2a14e0d0a819aad60161e743003dc7 100644 (file)
@@ -1368,7 +1368,7 @@ int main(int argc, char **argv)
        int home=0;
        char relhome[PATH_MAX]="";
        char ctdldir[PATH_MAX]=CTDLDIR;
-    
+    int lp; 
 
 
        calc_dirs_n_files(relh, home, relhome, ctdldir);
@@ -2261,6 +2261,11 @@ TERMN8:  scr_printf("%s logged out.", fullname);
                formout(ipc, "goodbye");
                logoff(ipc, 0);
        }
+       /* Free the ungoto list */
+       for (lp = 0; lp < uglistsize; lp++) {
+               free(uglist[lp]);
+       }
+    uglistsize = 0;
        goto GSTA;
 
 }      /* end main() */
index af0fbb40eb2e62553318ec0a768562ccd2361f56..36dcea8a239e6980fd41caf6f84620dd70381018 100644 (file)
@@ -1834,6 +1834,7 @@ int CtdlIPCSetSystemConfig(CtdlIPC *ipc, const char *listing, char *cret)
 int CtdlIPCGetSystemConfigByType(CtdlIPC *ipc, const char *mimetype,
                char **listing, char *cret)
 {
+       register int ret;
        char *aaa;
        size_t bytes;
 
@@ -1845,8 +1846,10 @@ int CtdlIPCGetSystemConfigByType(CtdlIPC *ipc, const char *mimetype,
        aaa = malloc(strlen(mimetype) + 13);
        if (!aaa) return -1;
        sprintf(aaa, "CONF GETSYS|%s", mimetype);
-       return CtdlIPCGenericCommand(ipc, aaa, NULL, 0,
+       ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0,
                        listing, &bytes, cret);
+    free(aaa);
+    return ret;
 }
 
 
@@ -1854,6 +1857,7 @@ int CtdlIPCGetSystemConfigByType(CtdlIPC *ipc, const char *mimetype,
 int CtdlIPCSetSystemConfigByType(CtdlIPC *ipc, const char *mimetype,
               const char *listing, char *cret)
 {
+    register int ret;
        char *aaa;
 
        if (!cret) return -2;
@@ -1863,8 +1867,10 @@ int CtdlIPCSetSystemConfigByType(CtdlIPC *ipc, const char *mimetype,
        aaa = malloc(strlen(mimetype) + 13);
        if (!aaa) return -1;
        sprintf(aaa, "CONF PUTSYS|%s", mimetype);
-       return CtdlIPCGenericCommand(ipc, aaa, listing, strlen(listing),
+       ret = CtdlIPCGenericCommand(ipc, aaa, listing, strlen(listing),
                        NULL, NULL, cret);
+    free(aaa);
+    return ret;
 }
 
 
@@ -2016,6 +2022,7 @@ static void endtls(SSL *ssl)
 /* QDIR */
 int CtdlIPCDirectoryLookup(CtdlIPC *ipc, const char *address, char *cret)
 {
+    register int ret;
        char *aaa;
 
        if (!address) return -2;
@@ -2025,7 +2032,9 @@ int CtdlIPCDirectoryLookup(CtdlIPC *ipc, const char *address, char *cret)
        if (!aaa) return -1;
 
        sprintf(aaa, "QDIR %s", address);
-       return CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
+       ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
+    free(aaa);
+    return ret;
 }
 
 
index 481d76075523e5741a47fe386b8115703fb84416..41d391858668e691c9e579944c12cd09f8ed0423 100644 (file)
@@ -1229,6 +1229,7 @@ int entmsg(CtdlIPC *ipc,
        /* Now compose the message... */
        if (client_make_message(ipc, temp, message.recipient,
           message.anonymous, 0, c, message.subject) != 0) {
+           if (msgarr) free(msgarr);   
                return (2);
        }
 
index 3a9673c4fe51ab5a17dd9951dad89cbafc3effb7..190b69dd2b5026a4c51d28ea73ddd4da15d394ee 100644 (file)
@@ -902,6 +902,8 @@ void do_system_configuration(CtdlIPC *ipc)
                }
 
        }
+    if (site_expirepolicy) free(site_expirepolicy);
+    if (mbx_expirepolicy) free(mbx_expirepolicy);
 }
 
 
@@ -1031,6 +1033,7 @@ void do_internet_configuration(CtdlIPC *ipc)
                                        scr_printf("Wrote %d records.\n", num_recs);
                                        modified = 0;
                                }
+                free(resp);
                                break;
                        case 'q':
                                quitting = !modified || boolprompt(
@@ -1302,6 +1305,7 @@ void do_ignet_configuration(CtdlIPC *ipc) {
                                        scr_printf("Wrote %d records.\n", num_recs);
                                        modified = 0;
                                }
+                free(listing);
                                break;
                        case 'q':
                                quitting = !modified || boolprompt(
@@ -1425,6 +1429,7 @@ void do_filterlist_configuration(CtdlIPC *ipc)
                                        scr_printf("Wrote %d records.\n", num_recs);
                                        modified = 0;
                                }
+                free(listing);
                                break;
                        case 'q':
                                quitting = !modified || boolprompt(