Fixed a potential memory leak (not to worry, it's
authorArt Cancro <ajc@citadel.org>
Sun, 1 Jun 2008 04:36:26 +0000 (04:36 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 1 Jun 2008 04:36:26 +0000 (04:36 +0000)
in new, unreleased code)

citadel/modules/openid/serv_openid_rp.c

index abc7b43c5d414ba25ed28eb299d7975f19c05c6a..2f8de996827756e6b603882fb76bdee1c30d1ef9 100644 (file)
@@ -119,6 +119,18 @@ int attach_openid(struct ctdluser *who, char *claimed_id)
  * When a user is being deleted, we have to delete any OpenID associations
  */
 void openid_purge(struct ctdluser *usbuf) {
+       struct cdbdata *cdboi;
+
+       cdb_rewind(CDB_OPENID);
+       while (cdboi = cdb_next_item(CDB_OPENID), cdboi != NULL) {
+               if (cdboi->len > sizeof(long)) {
+                       if (((long)*(cdboi->ptr)) == usbuf->usernum) {
+                               CtdlLogPrintf(CTDL_DEBUG, "FIXME we have to delete an openid\n");
+                       }
+               }
+               cdb_free(cdboi);
+       }
+
        /* FIXME finish this */
 }
 
@@ -140,6 +152,7 @@ void cmd_oidl(char *argbuf) {
                                cprintf("%s\n", cdboi->ptr + sizeof(long));
                        }
                }
+               cdb_free(cdboi);
        }
        cprintf("000\n");
 }
@@ -167,6 +180,7 @@ void cmd_oidd(char *argbuf) {
                                this_is_mine = 1;
                        }
                }
+               cdb_free(cdboi);
        }
 
        if (!this_is_mine) {