Skip to content

Commit

Permalink
store_avro_kafka: fix memory leak in serdes_schema_find()
Browse files Browse the repository at this point in the history
Fix leak in error path in store_avro_kafka.c:serdes_schema_find().
  • Loading branch information
morrone committed Aug 22, 2023
1 parent 21e9618 commit 2c50d65
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ldms/src/store/avro_kafka/store_avro_kafka.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,17 @@ serdes_schema_find(aks_handle_t sh, char *schema_name,

/* Create a new schema from the row specification and LDMS schema */
rc = ldmsd_row_to_json_avro_schema(row, &json_buf, &json_len);
if (rc)
if (rc) {
free(entry);
goto out;
}
sschema =
serdes_schema_add(sh->serdes,
schema_name, -1,
json_buf, json_len,
errstr, sizeof(errstr));
if (!sschema) {
free(entry);
LOG_ERROR("%s\n", json_buf);
LOG_ERROR("Error '%s' creating schema '%s'\n", errstr, schema_name);
goto out;
Expand Down

0 comments on commit 2c50d65

Please sign in to comment.