Bug #55510 » leak.c
1 |
#include <stdio.h>
|
---|---|
2 |
#include <lasso/lasso.h>
|
3 |
|
4 |
//Compile with:
|
5 |
// cc $(pkg-config --cflags --libs lasso gobject-2.0) -o leak leak.c
|
6 |
|
7 |
|
8 |
static const char DUMP[] = "<Identity xmlns=\"http://www.entrouvert.org/namespaces/lasso/0.0\" Version=\"2\"><lasso:Federation xmlns:lasso=\"http://www.entrouvert.org/namespaces/lasso/0.0\" xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\" RemoteProviderID=\"testsp.lxd\" FederationDumpVersion=\"2\"><lasso:LocalNameIdentifier><saml:NameID Format=\"urn:oasis:names:tc:SAML:2.0:nameid-format:persistent\" NameQualifier=\"https://auth.lemontest.lxd/saml/metadata\" SPNameQualifier=\"testsp.lxd\">_0CF12279B248F613593FF094D96508C0</saml:NameID></lasso:LocalNameIdentifier></lasso:Federation></Identity>"; |
9 |
|
10 |
int main(int argc, const char *argv[]) |
11 |
{
|
12 |
lasso_init(); |
13 |
|
14 |
while(1){ |
15 |
|
16 |
// Lasso::Identity allocated here
|
17 |
LassoIdentity *identity = lasso_identity_new_from_dump(DUMP); |
18 |
|
19 |
// Dump string allocated here
|
20 |
char *dumped = lasso_node_dump(LASSO_NODE(identity)); |
21 |
|
22 |
// Free objects
|
23 |
free(dumped); |
24 |
g_object_unref(identity); |
25 |
}
|
26 |
|
27 |
// No memory leaking here
|
28 |
}
|