mirror of
https://github.com/Monibuca/engine.git
synced 2025-10-06 17:16:55 +08:00
fix: g711 override memory
fix: PacketizeRTP memory leak fix: avoid read files beyond the log path
This commit is contained in:
@@ -21,8 +21,11 @@ func ReturnJson[T any](fetch func() T, tickDur time.Duration, rw http.ResponseWr
|
||||
return
|
||||
}
|
||||
}
|
||||
} else if err := json.NewEncoder(rw).Encode(fetch()); err != nil {
|
||||
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
||||
} else {
|
||||
rw.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(rw).Encode(fetch()); err != nil {
|
||||
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +39,11 @@ func ReturnYaml[T any](fetch func() T, tickDur time.Duration, rw http.ResponseWr
|
||||
return
|
||||
}
|
||||
}
|
||||
} else if err := yaml.NewEncoder(rw).Encode(fetch()); err != nil {
|
||||
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
||||
} else {
|
||||
rw.Header().Set("Content-Type", "application/yaml")
|
||||
if err := yaml.NewEncoder(rw).Encode(fetch()); err != nil {
|
||||
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user