if(rc)
return rc;
c->user = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
return 0;
}
if(rc)
return rc;
c->user = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
return 0;
}
return rc;
if(boolean("enabled", v[0], enabledp))
return -1;
+ free_strings(nv, v);
return 0;
}
return rc;
if(boolean("exists", v[0], existsp))
return -1;
+ free_strings(nv, v);
return 0;
}
if(rc)
return rc;
*valuep = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
return 0;
}
if(rc)
return rc;
*valuep = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
return 0;
}
if(rc)
return rc;
*lengthp = atol(v[0]);
+ free_strings(nv, v);
return 0;
}
if(rc)
return rc;
*cookiep = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
return 0;
}
if(rc)
return rc;
*partp = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
return 0;
}
return rc;
if(boolean("random-enabled", v[0], enabledp))
return -1;
+ free_strings(nv, v);
return 0;
}
if(rc)
return rc;
*confirmationp = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
return 0;
}
if(rc)
return rc;
*resolvedp = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
return 0;
}
if(rc)
return rc;
*addressp = v[0];
+ v[0] = NULL;
*portp = v[1];
+ v[1] = NULL;
+ free_strings(nv, v);
return 0;
}
if(rc)
return rc;
*valuep = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
return 0;
}
if(rc)
return rc;
*versionp = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
return 0;
}
return rc;
*leftp = atol(v[0]);
*rightp = atol(v[1]);
+ free_strings(nv, v);
return 0;
}
my $name = $return->[1];
if($type eq 'string') {
push(@c,
- " *${name}p = v[$n];\n");
+ " *${name}p = v[$n];\n",
+ " v[$n] = NULL;\n");
} elsif($type eq 'boolean') {
push(@c,
" if(boolean(\"$cmd\", v[$n], ${name}p))\n",
" *${name}p = atoll(v[$n]);\n");
} elsif($type eq 'user') {
push(@c,
- " c->user = v[$n];\n");
+ " c->user = v[$n];\n",
+ " v[$n] = NULL;\n");
} elsif($type eq 'body') {
push(@c,
" if(readlist(c, ${name}p, n${name}p))\n",
die "$0: C API: unknown return type '$type' for '$name'\n";
}
}
+ if($expected) {
+ push(@c,
+ " free_strings(nv, v);\n");
+ }
push(@c, " return 0;\n");
- # TODO xfree unconsumed split output
}
push(@c, "}\n\n");