ovsdb-idlc: Fix sizeof calculation in generated code.
authorBen Pfaff <blp@nicira.com>
Thu, 10 Jun 2010 22:31:55 +0000 (15:31 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 23 Jun 2010 19:43:02 +0000 (12:43 -0700)
commitd78ac3883fd1511505aa3f13db2a571015b03bf2
treeb9243ff14d03caa9ad5ba8ba1d44ffd4da99105e
parentcde3f1eebc60af0e93009179eeaadb7000be2b79
ovsdb-idlc: Fix sizeof calculation in generated code.

Generated <prefix>_<struct>_parse_<column> functions did not allocate
enough memory for the "value" array, because code that should have said,
e.g.:
    row->value_options = xmalloc(datum->n * sizeof *row->value_options);
actually said:
    row->value_options = xmalloc(datum->n * sizeof row->value_options);

This fixes the problem.  I also checked that the same problem didn't occur
elsewhere in the generated code.

(This would be a fairly serious bug fix, because without it reads and
writes beyond the end of allocated memory would be almost inevitable,
except that every existing map has string values, and sizeof(char*)
== sizeof(char**) on any sane system.)
ovsdb/ovsdb-idlc.in