1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

ldb:ldbedit tool - don't forget about the "do_edit" result code

Use it for computing the program exit code. The "result" has not to be
free'd explicitly since it's a child by "ldb" which itself is child by
"mem_ctx".
This commit is contained in:
Matthias Dieter Wallnöfer 2011-02-05 13:19:56 +01:00
parent 79d3532f7f
commit 475ea1ca59

View File

@ -343,20 +343,13 @@ int main(int argc, const char **argv)
if (result->count == 0) {
printf("no matching records - cannot edit\n");
return 0;
talloc_free(mem_ctx);
return LDB_SUCCESS;
}
do_edit(ldb, result->msgs, result->count, options->editor);
if (result) {
ret = talloc_free(result);
if (ret == -1) {
fprintf(stderr, "talloc_free failed\n");
exit(1);
}
}
ret = do_edit(ldb, result->msgs, result->count, options->editor);
talloc_free(mem_ctx);
return 0;
return ret == 0 ? LDB_SUCCESS : LDB_ERR_OPERATIONS_ERROR;
}